| 1 | import { pgTable, uuid, varchar, timestamp, pgEnum } from 'drizzle-orm/pg-core'; |
| 2 | |
| 3 | //Enum for users table |
| 4 | export const roleEnum = pgEnum('role', ['USER', 'ORGANIZER', 'ADMIN']); |
| 5 | |
| 6 | // Users tables |
| 7 | export const users = pgTable('users', { |
| 8 | id: uuid('id').defaultRandom().primaryKey(), |
| 9 | email: varchar('email', { length: 255 }).notNull(), |
| 10 | password: varchar('password', { length: 255 }).notNull(), |
| 11 | name: varchar('name', { length: 255 }).notNull(), |
| 12 | role: roleEnum('role').default('USER').notNull(), |
| 13 | createdAt: timestamp('created_at').defaultNow().notNull(), |
| 14 | updatedAt: timestamp('updated_at').defaultNow().notNull(), |
| 15 | }); |
| 16 | |
| 17 | export type User = typeof users.$inferSelect; |
| 18 | export type NewUser = typeof users.$inferInsert; |