feat: add tags schema with Drizzle ORM integration
This commit is contained in:
14
backend/src/database/schemas/tags.ts
Normal file
14
backend/src/database/schemas/tags.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { pgTable, varchar, timestamp, uuid, index } from 'drizzle-orm/pg-core';
|
||||
|
||||
export const tags = pgTable('tags', {
|
||||
id: uuid('id').primaryKey().defaultRandom(),
|
||||
name: varchar('name', { length: 64 }).notNull().unique(),
|
||||
slug: varchar('slug', { length: 64 }).notNull().unique(),
|
||||
createdAt: timestamp('created_at', { withTimezone: true }).notNull().defaultNow(),
|
||||
updatedAt: timestamp('updated_at', { withTimezone: true }).notNull().defaultNow(),
|
||||
}, (table) => ({
|
||||
slugIdx: index('tags_slug_idx').on(table.slug),
|
||||
}));
|
||||
|
||||
export type TagInDb = typeof tags.$inferSelect;
|
||||
export type NewTagInDb = typeof tags.$inferInsert;
|
||||
Reference in New Issue
Block a user