巴林闲侠
2 years ago
9 changed files with 100 additions and 41 deletions
@ -0,0 +1,43 @@ |
|||||
|
/* eslint-disable*/ |
||||
|
'use strict'; |
||||
|
|
||||
|
module.exports = dc => { |
||||
|
const DataTypes = dc.ORM; |
||||
|
const sequelize = dc.orm; |
||||
|
const App = sequelize.define("app", { |
||||
|
id: { |
||||
|
type: DataTypes.INTEGER, |
||||
|
allowNull: false, |
||||
|
defaultValue: null, |
||||
|
comment: null, |
||||
|
primaryKey: true, |
||||
|
field: "id", |
||||
|
autoIncrement: true, |
||||
|
unique: "app_id_uindex" |
||||
|
}, |
||||
|
name: { |
||||
|
type: DataTypes.STRING, |
||||
|
allowNull: false, |
||||
|
defaultValue: null, |
||||
|
comment: null, |
||||
|
primaryKey: false, |
||||
|
field: "name", |
||||
|
autoIncrement: false |
||||
|
}, |
||||
|
url: { |
||||
|
type: DataTypes.STRING, |
||||
|
allowNull: false, |
||||
|
defaultValue: null, |
||||
|
comment: null, |
||||
|
primaryKey: false, |
||||
|
field: "url", |
||||
|
autoIncrement: false |
||||
|
} |
||||
|
}, { |
||||
|
tableName: "app", |
||||
|
comment: "", |
||||
|
indexes: [] |
||||
|
}); |
||||
|
dc.models.App = App; |
||||
|
return App; |
||||
|
}; |
@ -1,2 +1,12 @@ |
|||||
|
alter table project_app drop column name; |
||||
|
|
||||
alter table project_app |
alter table project_app |
||||
add lock boolean default false not null; |
add app_id int; |
||||
|
|
||||
|
alter table project_app drop column url; |
||||
|
|
||||
|
alter table project_app drop column lock; |
||||
|
|
||||
|
alter table project_app |
||||
|
add constraint project_app_app_id_fk |
||||
|
foreign key (app_id) references app; |
||||
|
@ -0,0 +1,12 @@ |
|||||
|
create table if not exists app |
||||
|
( |
||||
|
id serial not null, |
||||
|
name varchar(256) not null, |
||||
|
url varchar(1024) not null, |
||||
|
constraint app_pk |
||||
|
primary key (id) |
||||
|
); |
||||
|
|
||||
|
create unique index if not exists app_id_uindex |
||||
|
on app (id); |
||||
|
|
@ -0,0 +1,5 @@ |
|||||
|
alter table app_alarm drop constraint app_alarm_project_app_id_fk; |
||||
|
|
||||
|
alter table app_alarm |
||||
|
add constraint app_alarm_app_id_fk |
||||
|
foreign key (project_app_id) references app; |
@ -0,0 +1,6 @@ |
|||||
|
alter table app_inspection drop constraint app_inspection_project_app_id_fk; |
||||
|
|
||||
|
alter table app_inspection |
||||
|
add constraint app_inspection_app_id_fk |
||||
|
foreign key (project_app_id) references app; |
||||
|
|
Loading…
Reference in new issue