feat: add tags schema with Drizzle ORM integration

This commit is contained in:
Mathis HERRIOT
2026-01-05 14:14:57 +01:00
parent 19ceac1303
commit 04ca5090df

View 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;