feat: 增加项目管理功能

引入 SQLite 数据库(Drizzle ORM + bun:sqlite),实现项目 CRUD 与归档/恢复/删除
生命周期管理,新增项目管理前端页面,migration 嵌入单文件构建产物保持部署体验。

- src/server/db: schema、connection、migration 执行器、项目数据访问层
- src/server/routes/projects: 7 个 API 端点(列表/创建/详情/更新/归档/恢复/删除)
- src/web: 项目管理页面(TDesign Table/Tabs/Dialog/Form),TanStack Query hooks
- scripts: 构建时嵌入 migration SQL,开发期独立 generate-migrations-data 脚本
- tests: 60 个后端测试 + 27 个前端测试,覆盖 DB/migration/API/路由/页面
- docs: 更新架构、后端、发布、配置、部署、使用文档
This commit is contained in:
2026-05-27 18:54:44 +08:00
parent 348b35ef8c
commit d5a0ba9e9e
44 changed files with 2458 additions and 43 deletions

View File

@@ -0,0 +1,16 @@
CREATE TABLE `projects` (
`archived_at` text,
`created_at` text NOT NULL,
`description` text DEFAULT '' NOT NULL,
`id` text PRIMARY KEY NOT NULL,
`name` text NOT NULL,
`status` text DEFAULT 'active' NOT NULL CHECK (status IN ('active', 'archived')),
`updated_at` text NOT NULL
);
--> statement-breakpoint
CREATE UNIQUE INDEX `projects_name_unique` ON `projects` (`name`);--> statement-breakpoint
CREATE TABLE IF NOT EXISTS `schema_migrations` (
`applied_at` text NOT NULL,
`checksum` text NOT NULL,
`id` text PRIMARY KEY NOT NULL
);

View File

@@ -0,0 +1,116 @@
{
"version": "6",
"dialect": "sqlite",
"id": "7c940c6c-2dd6-4509-aad1-90aa48887cb9",
"prevId": "00000000-0000-0000-0000-000000000000",
"tables": {
"projects": {
"name": "projects",
"columns": {
"archived_at": {
"name": "archived_at",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"created_at": {
"name": "created_at",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "''"
},
"id": {
"name": "id",
"type": "text",
"primaryKey": true,
"notNull": true,
"autoincrement": false
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "'active'"
},
"updated_at": {
"name": "updated_at",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
}
},
"indexes": {
"projects_name_unique": {
"name": "projects_name_unique",
"columns": ["name"],
"isUnique": true
}
},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"checkConstraints": {}
},
"schema_migrations": {
"name": "schema_migrations",
"columns": {
"applied_at": {
"name": "applied_at",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"checksum": {
"name": "checksum",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"id": {
"name": "id",
"type": "text",
"primaryKey": true,
"notNull": true,
"autoincrement": false
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"checkConstraints": {}
}
},
"views": {},
"enums": {},
"_meta": {
"schemas": {},
"tables": {},
"columns": {}
},
"internal": {
"indexes": {}
}
}

View File

@@ -0,0 +1,13 @@
{
"version": "7",
"dialect": "sqlite",
"entries": [
{
"idx": 0,
"version": "6",
"when": 1779873780188,
"tag": "0000_cheerful_switch",
"breakpoints": true
}
]
}