From 293fdde2b215fd08a32dfc1f90897295f4883660 Mon Sep 17 00:00:00 2001 From: "gao.zhiyuan" Date: Fri, 16 Sep 2022 14:54:29 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=89=E5=BF=83=E4=BA=91=E3=80=81=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E7=AE=A1=E7=90=86=E9=A1=B9=E7=9B=AE=E8=8E=B7=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/app/lib/controllers/project/index.js | 3 +++ api/app/lib/models/project_app.js | 9 +++++++++ api/sequelize-automate.config.js | 2 +- .../3.update_tables.sql => 0.0.2/1.update_tables.sql} | 0 script/0.0.3/3.alert_project_app.sql | 2 ++ 5 files changed, 15 insertions(+), 1 deletion(-) rename script/{0.0.1/3.update_tables.sql => 0.0.2/1.update_tables.sql} (100%) create mode 100644 script/0.0.3/3.alert_project_app.sql diff --git a/api/app/lib/controllers/project/index.js b/api/app/lib/controllers/project/index.js index 6c0c3f5..49cf778 100644 --- a/api/app/lib/controllers/project/index.js +++ b/api/app/lib/controllers/project/index.js @@ -30,6 +30,9 @@ async function pomsProject (ctx) { where: {}, include: { model: models.ProjectApp, + where: { + lock: false + }, attributes: { exclude: ['projectId'] } diff --git a/api/app/lib/models/project_app.js b/api/app/lib/models/project_app.js index 4b1f44c..24c2640 100644 --- a/api/app/lib/models/project_app.js +++ b/api/app/lib/models/project_app.js @@ -45,6 +45,15 @@ module.exports = dc => { key: "id", model: "projectCorrelation" } + }, + lock: { + type: DataTypes.BOOLEAN, + allowNull: false, + defaultValue: null, + comment: null, + primaryKey: false, + field: "lock", + autoIncrement: false } }, { tableName: "project_app", diff --git a/api/sequelize-automate.config.js b/api/sequelize-automate.config.js index e34d53b..41e326f 100644 --- a/api/sequelize-automate.config.js +++ b/api/sequelize-automate.config.js @@ -26,7 +26,7 @@ module.exports = { dir: './app/lib/models', // 指定输出 models 文件的目录 typesDir: 'models', // 指定输出 TypeScript 类型定义的文件目录,只有 TypeScript / Midway 等会有类型定义 emptyDir: false, // !!! 谨慎操作 生成 models 之前是否清空 `dir` 以及 `typesDir` - tables: ['app_alarm'], // 指定生成哪些表的 models,如 ['user', 'user_post'];如果为 null,则忽略改属性 + tables: ['project_app'], // 指定生成哪些表的 models,如 ['user', 'user_post'];如果为 null,则忽略改属性 skipTables: [], // 指定跳过哪些表的 models,如 ['user'];如果为 null,则忽略改属性 tsNoCheck: false, // 是否添加 `@ts-nocheck` 注释到 models 文件中 ignorePrefix: [], // 生成的模型名称忽略的前缀,因为 项目中有以下表名是以 t_ 开头的,在实际模型中不需要, 可以添加多个 [ 't_data_', 't_',] ,长度较长的 前缀放前面 diff --git a/script/0.0.1/3.update_tables.sql b/script/0.0.2/1.update_tables.sql similarity index 100% rename from script/0.0.1/3.update_tables.sql rename to script/0.0.2/1.update_tables.sql diff --git a/script/0.0.3/3.alert_project_app.sql b/script/0.0.3/3.alert_project_app.sql new file mode 100644 index 0000000..5a45415 --- /dev/null +++ b/script/0.0.3/3.alert_project_app.sql @@ -0,0 +1,2 @@ +alter table project_app + add lock boolean default false not null; \ No newline at end of file