Create devenv for PG. Add drizzle.

Change-Id: If322ee9ef1c290465e93bd7140eadfc90ee2d30d
Reviewed-on: https://git.clicks.codes/c/Caramels/Lotting/+/343
Reviewed-by: Samuel Shuert <coded@clicks.codes>
Tested-by: Samuel Shuert <coded@clicks.codes>
diff --git a/lib/db.ts b/lib/db.ts
new file mode 100644
index 0000000..310cb08
--- /dev/null
+++ b/lib/db.ts
@@ -0,0 +1,13 @@
+import { drizzle } from "drizzle-orm/postgres-js";
+import { migrate } from "drizzle-orm/postgres-js/migrator";
+import postgres from "postgres";
+
+const sql = postgres("...", { max: 1 })
+const db = drizzle(sql);
+
+(async () => {
+    await migrate(db, { migrationsFolder: "drizzle" });
+    await sql.end();
+})();
+
+export { db }
\ No newline at end of file
diff --git a/lib/schema.ts b/lib/schema.ts
new file mode 100644
index 0000000..c5506cd
--- /dev/null
+++ b/lib/schema.ts
@@ -0,0 +1,62 @@
+import {
+    timestamp,
+    pgTable,
+    text,
+    primaryKey,
+    integer
+} from "drizzle-orm/pg-core"
+import type { AdapterAccount } from '@auth/core/adapters'
+
+export const users = pgTable("user", {
+    id: text("id").notNull().primaryKey(),
+    name: text("name"),
+    email: text("email").notNull(),
+    emailVerified: timestamp("emailVerified", { mode: "date" }),
+    image: text("image"),
+})
+
+export const accounts = pgTable(
+    "account",
+    {
+        userId: text("userId")
+            .notNull()
+            .references(() => users.id, { onDelete: "cascade" }),
+        type: text("type").$type<AdapterAccount["type"]>().notNull(),
+        provider: text("provider").notNull(),
+        providerAccountId: text("providerAccountId").notNull(),
+        refresh_token: text("refresh_token"),
+        access_token: text("access_token"),
+        expires_at: integer("expires_at"),
+        token_type: text("token_type"),
+        scope: text("scope"),
+        id_token: text("id_token"),
+        session_state: text("session_state"),
+    },
+    (account) => ({
+        compoundKey: primaryKey({ columns: [account.provider, account.providerAccountId] }),
+    })
+)
+
+export const sessions = pgTable("session", {
+    sessionToken: text("sessionToken").notNull().primaryKey(),
+    userId: text("userId")
+        .notNull()
+        .references(() => users.id, { onDelete: "cascade" }),
+    expires: timestamp("expires", { mode: "date" }).notNull(),
+})
+
+export const verificationTokens = pgTable(
+    "verificationToken",
+    {
+        identifier: text("identifier").notNull(),
+        token: text("token").notNull(),
+        expires: timestamp("expires", { mode: "date" }).notNull(),
+    },
+    (vt) => ({
+        compoundKey: primaryKey({ columns: [vt.identifier, vt.token] }),
+    })
+)
+
+export const lots = pgTable("lots", {
+    
+})
\ No newline at end of file