4 changed files with 87 additions and 1 deletions
@ -0,0 +1,37 @@ |
|||||
|
/* eslint-disable*/ |
||||
|
'use strict'; |
||||
|
|
||||
|
module.exports = dc => { |
||||
|
const DataTypes = dc.ORM; |
||||
|
const sequelize = dc.orm; |
||||
|
const CheckItems = sequelize.define("check_items", { |
||||
|
id: { |
||||
|
field: "id", |
||||
|
type: DataTypes.INTEGER, |
||||
|
allowNull: false, |
||||
|
primaryKey: true, |
||||
|
autoIncrement: true, |
||||
|
}, |
||||
|
name: { |
||||
|
field: "name", |
||||
|
type: DataTypes.STRING, |
||||
|
allowNull: false, |
||||
|
primaryKey: false, |
||||
|
autoIncrement: false |
||||
|
}, |
||||
|
groupId: { |
||||
|
field: "group_id", |
||||
|
type: DataTypes.INTEGER, |
||||
|
allowNull: true, |
||||
|
primaryKey: false, |
||||
|
autoIncrement: false |
||||
|
} |
||||
|
}, { |
||||
|
tableName: "check_items", |
||||
|
comment: "", |
||||
|
indexes: [] |
||||
|
}); |
||||
|
|
||||
|
dc.models.CheckItems = CheckItems; |
||||
|
return CheckItems; |
||||
|
}; |
@ -0,0 +1,30 @@ |
|||||
|
/* eslint-disable*/ |
||||
|
'use strict'; |
||||
|
|
||||
|
module.exports = dc => { |
||||
|
const DataTypes = dc.ORM; |
||||
|
const sequelize = dc.orm; |
||||
|
const CheckItemsGroup = sequelize.define("check_items_group", { |
||||
|
id: { |
||||
|
field: "id", |
||||
|
type: DataTypes.INTEGER, |
||||
|
allowNull: false, |
||||
|
primaryKey: true, |
||||
|
autoIncrement: true, |
||||
|
}, |
||||
|
name: { |
||||
|
field: "name", |
||||
|
type: DataTypes.STRING, |
||||
|
allowNull: false, |
||||
|
primaryKey: false, |
||||
|
autoIncrement: false |
||||
|
} |
||||
|
}, { |
||||
|
tableName: "check_items_group", |
||||
|
comment: "", |
||||
|
indexes: [] |
||||
|
}); |
||||
|
|
||||
|
dc.models.CheckItemsGroup = CheckItemsGroup; |
||||
|
return CheckItemsGroup; |
||||
|
}; |
@ -0,0 +1,15 @@ |
|||||
|
DROP TABLE IF EXISTS "public"."check_items_group"; |
||||
|
CREATE TABLE "public"."check_items_group" ( |
||||
|
"id" serial, |
||||
|
"name" varchar(255) NOT NULL, |
||||
|
PRIMARY KEY ("id") |
||||
|
); |
||||
|
|
||||
|
DROP TABLE IF EXISTS "public"."check_items"; |
||||
|
CREATE TABLE "public"."check_items" ( |
||||
|
"id" serial, |
||||
|
"name" varchar(255) NOT NULL, |
||||
|
"group_id" int, |
||||
|
PRIMARY KEY ("id"), |
||||
|
FOREIGN KEY (group_id) REFERENCES check_items_group(id) |
||||
|
); |
Loading…
Reference in new issue