初始表结构
This commit is contained in:
parent
06e35dc044
commit
e2cc292f11
72
README.md
72
README.md
@ -7,3 +7,75 @@
|
||||
npm i --registry=https://registry.npmmirror.com
|
||||
|
||||
```
|
||||
|
||||
1. 日志格式数据, 时间戳,hash,作者,类型CURD,语句DATA
|
||||
2. MD视图数据
|
||||
1. 表示颜色
|
||||
2. 表示用户
|
||||
3. 表示转向
|
||||
|
||||
- [ ] 推转(将任务推到下一个工序)
|
||||
- [ ] 推转等待(下一个工序处理后仍要回执的, 等待过长会造成效率低下)
|
||||
- [ ] 创建项目
|
||||
- [ ] 发布任务
|
||||
|
||||
|
||||
```sql
|
||||
-- 用户表
|
||||
CREATE TABLE users (
|
||||
id INTEGER PRIMARY KEY,
|
||||
name TEXT NOT NULL,
|
||||
avatar TEXT, -- 存储头像的 URL 或路径
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, -- 自动设置创建时间
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, -- 自动设置更新时间
|
||||
CHECK (created_at <= updated_at) -- 确保更新时间不早于创建时间
|
||||
);
|
||||
|
||||
-- 项目表
|
||||
CREATE TABLE projects (
|
||||
id INTEGER PRIMARY KEY,
|
||||
user_id INTEGER NOT NULL,
|
||||
name TEXT NOT NULL,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, -- 自动设置创建时间
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, -- 自动设置更新时间
|
||||
FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE CASCADE,
|
||||
CHECK (created_at <= updated_at) -- 确保更新时间不早于创建时间
|
||||
);
|
||||
|
||||
-- 任务表
|
||||
CREATE TABLE tasks (
|
||||
id INTEGER PRIMARY KEY,
|
||||
project_id INTEGER NOT NULL,
|
||||
name TEXT NOT NULL,
|
||||
status TEXT NOT NULL DEFAULT '未开始', -- 任务状态默认未开始
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, -- 自动设置创建时间
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, -- 自动设置更新时间
|
||||
FOREIGN KEY (project_id) REFERENCES projects (id) ON DELETE CASCADE,
|
||||
CHECK (created_at <= updated_at), -- 确保更新时间不早于创建时间
|
||||
CHECK (status IN ('未开始', '进行中', '已完成')) -- 限制任务状态为预定义值
|
||||
);
|
||||
|
||||
|
||||
-- 问题发现 > 分析原因 > 处理方案 > 处理结果
|
||||
-- 功能新增 > 分析需求 > 规划方案 > 实施结果
|
||||
|
||||
|
||||
-- 触发器(自动设置更新时间)
|
||||
CREATE TRIGGER update_users AFTER UPDATE ON users FOR EACH ROW BEGIN
|
||||
UPDATE users SET updated_at = CURRENT_TIMESTAMP WHERE id = OLD.id;
|
||||
END;
|
||||
|
||||
CREATE TRIGGER update_projects AFTER UPDATE ON projects FOR EACH ROW BEGIN
|
||||
UPDATE projects SET updated_at = CURRENT_TIMESTAMP WHERE id = OLD.id;
|
||||
END;
|
||||
|
||||
CREATE TRIGGER update_tasks AFTER UPDATE ON tasks FOR EACH ROW BEGIN
|
||||
UPDATE tasks SET updated_at = CURRENT_TIMESTAMP WHERE id = OLD.id;
|
||||
END;
|
||||
|
||||
```
|
||||
|
||||
默认情况下,SQLite 的外键约束是关闭的,需要在每次连接数据库时显式启用外键支持。否则,外键约束将不会生效。
|
||||
```sql
|
||||
PRAGMA foreign_keys = ON;
|
||||
```
|
||||
|
@ -5,6 +5,7 @@
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "vite build",
|
||||
"start": "vite preview",
|
||||
"vueserve": "vue-cli-service serve",
|
||||
"vuebuild": "vue-cli-service build",
|
||||
"vuelint": "vue-cli-service lint"
|
||||
|
@ -1,5 +1,13 @@
|
||||
const { defineConfig } = require('@vue/cli-service')
|
||||
module.exports = defineConfig({
|
||||
transpileDependencies: true,
|
||||
lintOnSave: false
|
||||
})
|
||||
export default {
|
||||
build: {
|
||||
minify: 'terser', // 启用 Terser 压缩
|
||||
terserOptions: {
|
||||
compress: {
|
||||
keep_fnames: true // 禁用压缩对象名
|
||||
},
|
||||
output: {
|
||||
beautify: true // 保留对象名
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user