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