|
| 1 | +import { integer, sqliteTable, text } from "drizzle-orm/sqlite-core"; |
| 2 | + |
| 3 | +export const user = sqliteTable("user", { |
| 4 | + id: text("id").primaryKey(), |
| 5 | + name: text("name").notNull(), |
| 6 | + email: text("email").notNull().unique(), |
| 7 | + emailVerified: integer("email_verified", { mode: "boolean" }).notNull(), |
| 8 | + image: text("image"), |
| 9 | + createdAt: integer("created_at", { mode: "timestamp" }).notNull(), |
| 10 | + updatedAt: integer("updated_at", { mode: "timestamp" }).notNull(), |
| 11 | +}); |
| 12 | + |
| 13 | +export const session = sqliteTable("session", { |
| 14 | + id: text("id").primaryKey(), |
| 15 | + expiresAt: integer("expires_at", { mode: "timestamp" }).notNull(), |
| 16 | + token: text("token").notNull().unique(), |
| 17 | + createdAt: integer("created_at", { mode: "timestamp" }).notNull(), |
| 18 | + updatedAt: integer("updated_at", { mode: "timestamp" }).notNull(), |
| 19 | + ipAddress: text("ip_address"), |
| 20 | + userAgent: text("user_agent"), |
| 21 | + userId: text("user_id") |
| 22 | + .notNull() |
| 23 | + .references(() => user.id), |
| 24 | +}); |
| 25 | + |
| 26 | +export const account = sqliteTable("account", { |
| 27 | + id: text("id").primaryKey(), |
| 28 | + accountId: text("account_id").notNull(), |
| 29 | + providerId: text("provider_id").notNull(), |
| 30 | + userId: text("user_id") |
| 31 | + .notNull() |
| 32 | + .references(() => user.id), |
| 33 | + accessToken: text("access_token"), |
| 34 | + refreshToken: text("refresh_token"), |
| 35 | + idToken: text("id_token"), |
| 36 | + accessTokenExpiresAt: integer("access_token_expires_at", { |
| 37 | + mode: "timestamp", |
| 38 | + }), |
| 39 | + refreshTokenExpiresAt: integer("refresh_token_expires_at", { |
| 40 | + mode: "timestamp", |
| 41 | + }), |
| 42 | + scope: text("scope"), |
| 43 | + password: text("password"), |
| 44 | + createdAt: integer("created_at", { mode: "timestamp" }).notNull(), |
| 45 | + updatedAt: integer("updated_at", { mode: "timestamp" }).notNull(), |
| 46 | +}); |
| 47 | + |
| 48 | +export const verification = sqliteTable("verification", { |
| 49 | + id: text("id").primaryKey(), |
| 50 | + identifier: text("identifier").notNull(), |
| 51 | + value: text("value").notNull(), |
| 52 | + expiresAt: integer("expires_at", { mode: "timestamp" }).notNull(), |
| 53 | + createdAt: integer("created_at", { mode: "timestamp" }), |
| 54 | + updatedAt: integer("updated_at", { mode: "timestamp" }), |
| 55 | +}); |
0 commit comments