From e2cc292f1193c51e6f2fec2db852b312e8b6cd92 Mon Sep 17 00:00:00 2001 From: satori Date: Tue, 14 Jan 2025 20:53:10 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9D=E5=A7=8B=E8=A1=A8=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++ package.json | 1 + vue.config.js | 18 +++++++++---- 3 files changed, 86 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index fd7177f..374b83c 100644 --- a/README.md +++ b/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; +``` diff --git a/package.json b/package.json index 566b935..bcc4a8b 100755 --- a/package.json +++ b/package.json @@ -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" diff --git a/vue.config.js b/vue.config.js index 6596a0b..7101503 100755 --- a/vue.config.js +++ b/vue.config.js @@ -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 // 保留对象名 + } + } + } +}