forked from imbytecat/fullstack-starter
feat: 添加 UUID 支持及待办事项数据表定义
- 添加 uuid 依赖以支持唯一标识符生成 - 移除对 todoTable 的导出,不再从数据库模式文件中暴露该表定义。 - 导出 todo 模式定义文件中的所有内容 - 添加待办事项数据表定义,包含标题和完成状态字段,并集成自动生成字段。 - 添加用于定义主键、创建时间和更新时间字段的实用工具函数,并支持不同 PostgreSQL 版本的 UUID 生成策略,同时提供生成字段的键名映射。 - 添加 uuid 依赖到项目中
This commit is contained in:
8
apps/server/src/db/schema/todo.ts
Normal file
8
apps/server/src/db/schema/todo.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
import { boolean, pgTable, text } from 'drizzle-orm/pg-core'
|
||||
import { generatedFields } from './utils/field'
|
||||
|
||||
export const todoTable = pgTable('todo', {
|
||||
...generatedFields,
|
||||
title: text('title').notNull(),
|
||||
completed: boolean('completed').notNull().default(false),
|
||||
})
|
||||
Reference in New Issue
Block a user