From 6a01f3c757dd8a34d52ab512c3d059c094413d86 Mon Sep 17 00:00:00 2001 From: "gao.zhiyuan" Date: Wed, 10 Aug 2022 10:04:10 +0800 Subject: [PATCH] application table --- .../api/app/lib/models/application.js | 88 +++++++++++++++++++ .../api/sequelize-automate.config.js | 2 +- .../1.2.1/schema/1.create_application.sql | 19 ++++ 3 files changed, 108 insertions(+), 1 deletion(-) create mode 100644 code/VideoAccess-VCMP/api/app/lib/models/application.js create mode 100644 code/VideoAccess-VCMP/script/1.2.1/schema/1.create_application.sql diff --git a/code/VideoAccess-VCMP/api/app/lib/models/application.js b/code/VideoAccess-VCMP/api/app/lib/models/application.js new file mode 100644 index 0000000..527a521 --- /dev/null +++ b/code/VideoAccess-VCMP/api/app/lib/models/application.js @@ -0,0 +1,88 @@ +/* eslint-disable*/ +'use strict'; + +module.exports = dc => { + const DataTypes = dc.ORM; + const sequelize = dc.orm; + const Application = sequelize.define("application", { + id: { + type: DataTypes.INTEGER, + allowNull: false, + defaultValue: null, + comment: null, + primaryKey: true, + field: "id", + autoIncrement: true, + unique: "application_id_uindex" + }, + name: { + type: DataTypes.STRING, + allowNull: false, + defaultValue: null, + comment: null, + primaryKey: false, + field: "name", + autoIncrement: false + }, + type: { + type: array, + allowNull: true, + defaultValue: null, + comment: "web / app / wxapp / other", + primaryKey: false, + field: "type", + autoIncrement: false + }, + appKey: { + type: DataTypes.STRING, + allowNull: false, + defaultValue: null, + comment: null, + primaryKey: false, + field: "app_key", + autoIncrement: false + }, + appSecret: { + type: DataTypes.STRING, + allowNull: false, + defaultValue: null, + comment: null, + primaryKey: false, + field: "app_secret", + autoIncrement: false + }, + createUserId: { + type: DataTypes.INTEGER, + allowNull: false, + defaultValue: null, + comment: null, + primaryKey: false, + field: "create_user_id", + autoIncrement: false + }, + createTime: { + type: DataTypes.DATE, + allowNull: false, + defaultValue: null, + comment: null, + primaryKey: false, + field: "create_time", + autoIncrement: false + }, + forbidden: { + type: DataTypes.BOOLEAN, + allowNull: false, + defaultValue: null, + comment: null, + primaryKey: false, + field: "forbidden", + autoIncrement: false + } + }, { + tableName: "application", + comment: "", + indexes: [] + }); + dc.models.Application = Application; + return Application; +}; \ No newline at end of file diff --git a/code/VideoAccess-VCMP/api/sequelize-automate.config.js b/code/VideoAccess-VCMP/api/sequelize-automate.config.js index aaf2887..37bcdc0 100644 --- a/code/VideoAccess-VCMP/api/sequelize-automate.config.js +++ b/code/VideoAccess-VCMP/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: ['camera_status_offline_log'], // 指定生成哪些表的 models,如 ['user', 'user_post'];如果为 null,则忽略改属性 + tables: ['application'], // 指定生成哪些表的 models,如 ['user', 'user_post'];如果为 null,则忽略改属性 skipTables: [], // 指定跳过哪些表的 models,如 ['user'];如果为 null,则忽略改属性 tsNoCheck: false, // 是否添加 `@ts-nocheck` 注释到 models 文件中 ignorePrefix: [], // 生成的模型名称忽略的前缀,因为 项目中有以下表名是以 t_ 开头的,在实际模型中不需要, 可以添加多个 [ 't_data_', 't_',] ,长度较长的 前缀放前面 diff --git a/code/VideoAccess-VCMP/script/1.2.1/schema/1.create_application.sql b/code/VideoAccess-VCMP/script/1.2.1/schema/1.create_application.sql new file mode 100644 index 0000000..f117d3d --- /dev/null +++ b/code/VideoAccess-VCMP/script/1.2.1/schema/1.create_application.sql @@ -0,0 +1,19 @@ +create table if not exists application +( + id serial not null, + name varchar(32) not null, + type character varying[], + app_key varchar(64) not null, + app_secret varchar(64) not null, + create_user_id integer not null, + create_time timestamp not null, + forbidden boolean default false not null, + constraint application_pk + primary key (id) +); + +comment on column application.type is 'web / app / wxapp / other'; + +create unique index if not exists application_id_uindex + on application (id); +