feat: initial commit
This commit is contained in:
commit
e54dee08c8
29 changed files with 4857 additions and 0 deletions
20
src/shared/database/schema.ts
Normal file
20
src/shared/database/schema.ts
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
import { sql } from 'drizzle-orm'
|
||||
import { bigint, pgTable, timestamp, uuid, varchar } from 'drizzle-orm/pg-core'
|
||||
|
||||
export const roleSchema = pgTable('roles', {
|
||||
id: uuid('id').primaryKey().defaultRandom(),
|
||||
slug: varchar('slug', { length: 32 }).notNull(),
|
||||
aliases: varchar('aliases', { length: 32 }).array().notNull().default([]),
|
||||
chatId: bigint('chat_id', { mode: 'number' }).notNull(),
|
||||
|
||||
createdAt: timestamp('created_at').notNull().defaultNow(),
|
||||
updatedAt: timestamp('updated_at').notNull().defaultNow().$onUpdate(() => sql`now()`),
|
||||
})
|
||||
|
||||
export const roleMembersSchema = pgTable('role_members', {
|
||||
id: uuid('id').primaryKey().defaultRandom(),
|
||||
roleId: uuid('role_id').references(() => roleSchema.id),
|
||||
userId: bigint('user_id', { mode: 'number' }).notNull(),
|
||||
|
||||
createdAt: timestamp('created_at').notNull().defaultNow(),
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue