From 04ca5090dfe8c4228e6d956bb94bfe25dd79e68c Mon Sep 17 00:00:00 2001 From: Mathis HERRIOT <197931332+0x485254@users.noreply.github.com> Date: Mon, 5 Jan 2026 14:14:57 +0100 Subject: [PATCH] feat: add tags schema with Drizzle ORM integration --- backend/src/database/schemas/tags.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 backend/src/database/schemas/tags.ts 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;