import { text, unique } from 'drizzle-orm/pg-core'; import { siteSchema } from './schemas'; import { id, timestamps } from './helpers'; export const blogArticleStatus = siteSchema.enum('blog_article_status', ['draft', 'published']); export const blogArticles = siteSchema.table( 'blog_articles', { id: id(), title: text('title').notNull(), slug: text('slug').notNull(), content: text('content').notNull().default(''), tags: text('tags').array().notNull().default([]), status: blogArticleStatus('status').notNull().default('draft'), ...timestamps }, (table) => [unique().on(table.slug)] ); export type BlogArticle = typeof blogArticles.$inferSelect; export type NewBlogArticle = typeof blogArticles.$inferInsert; export type BlogArticleStatus = (typeof blogArticleStatus.enumValues)[number];