diff --git a/backend/src/database/schemas/tags.ts b/backend/src/database/schemas/tags.ts new file mode 100644 index 0000000..69f43aa --- /dev/null +++ b/backend/src/database/schemas/tags.ts @@ -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;