refactor: make block kind enum dynamic in schema (#762)
This commit is contained in:
parent
5e059844a2
commit
dfc07ce0ae
1 changed files with 2 additions and 3 deletions
|
|
@ -10,6 +10,7 @@ import {
|
||||||
foreignKey,
|
foreignKey,
|
||||||
boolean,
|
boolean,
|
||||||
} from 'drizzle-orm/pg-core';
|
} from 'drizzle-orm/pg-core';
|
||||||
|
import { blockKinds } from '../blocks/server';
|
||||||
|
|
||||||
export const user = pgTable('User', {
|
export const user = pgTable('User', {
|
||||||
id: uuid('id').primaryKey().notNull().defaultRandom(),
|
id: uuid('id').primaryKey().notNull().defaultRandom(),
|
||||||
|
|
@ -72,9 +73,7 @@ export const document = pgTable(
|
||||||
createdAt: timestamp('createdAt').notNull(),
|
createdAt: timestamp('createdAt').notNull(),
|
||||||
title: text('title').notNull(),
|
title: text('title').notNull(),
|
||||||
content: text('content'),
|
content: text('content'),
|
||||||
kind: varchar('text', { enum: ['text', 'code', 'image', 'sheet'] })
|
kind: varchar('text', { enum: blockKinds }).notNull().default('text'),
|
||||||
.notNull()
|
|
||||||
.default('text'),
|
|
||||||
userId: uuid('userId')
|
userId: uuid('userId')
|
||||||
.notNull()
|
.notNull()
|
||||||
.references(() => user.id),
|
.references(() => user.id),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue