refactor: make block kind enum dynamic in schema (#762)

This commit is contained in:
Jeremy 2025-02-05 18:47:17 +03:00 committed by GitHub
parent 5e059844a2
commit dfc07ce0ae
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -10,6 +10,7 @@ import {
foreignKey,
boolean,
} from 'drizzle-orm/pg-core';
import { blockKinds } from '../blocks/server';
export const user = pgTable('User', {
id: uuid('id').primaryKey().notNull().defaultRandom(),
@ -72,9 +73,7 @@ export const document = pgTable(
createdAt: timestamp('createdAt').notNull(),
title: text('title').notNull(),
content: text('content'),
kind: varchar('text', { enum: ['text', 'code', 'image', 'sheet'] })
.notNull()
.default('text'),
kind: varchar('text', { enum: blockKinds }).notNull().default('text'),
userId: uuid('userId')
.notNull()
.references(() => user.id),