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