import { text, timestamp, varchar, integer } from "drizzle-orm/pg-core"; import { createTable } from "../utils"; export const users = createTable("user", { id: varchar("id", { length: 255 }).notNull().primaryKey(), email: varchar("email", { length: 255 }).notNull(), firstName: varchar("first_name", { length: 255 }), lastName: varchar("last_name", { length: 255 }), password: varchar("password", { length: 255 }), emailVerified: timestamp("emailVerified", { mode: "date" }), image: text("image"), }); export const accounts = createTable("account", { userId: varchar("userId", { length: 255 }) .notNull() .references(() => users.id), type: varchar("type", { length: 255 }) .$type<"oauth" | "oidc" | "email">() .notNull(), provider: varchar("provider", { length: 255 }).notNull(), providerAccountId: varchar("providerAccountId", { length: 255 }).notNull(), refresh_token: text("refresh_token"), access_token: text("access_token"), expires_at: integer("expires_at"), token_type: varchar("token_type", { length: 255 }), scope: varchar("scope", { length: 255 }), id_token: text("id_token"), session_state: varchar("session_state", { length: 255 }), }); export const sessions = createTable("session", { sessionToken: varchar("sessionToken", { length: 255 }).notNull().primaryKey(), userId: varchar("userId", { length: 255 }) .notNull() .references(() => users.id), expires: timestamp("expires", { mode: "date" }).notNull(), }); export const verificationTokens = createTable("verificationToken", { identifier: varchar("identifier", { length: 255 }).notNull(), token: varchar("token", { length: 255 }).notNull(), expires: timestamp("expires", { mode: "date" }).notNull(), });