10 changed files with 148 additions and 44 deletions
			
			
		| @ -0,0 +1,50 @@ | |||
| /* eslint-disable*/ | |||
| 'use strict'; | |||
| 
 | |||
| module.exports = dc => { | |||
|   const DataTypes = dc.ORM; | |||
|   const sequelize = dc.orm; | |||
|   const PatrolPlanUser = sequelize.define("patrolPlanUser", { | |||
|     id: { | |||
|       type: DataTypes.INTEGER, | |||
|       allowNull: false, | |||
|       defaultValue: null, | |||
|       comment: null, | |||
|       primaryKey: true, | |||
|       field: "id", | |||
|       autoIncrement: true, | |||
|     }, | |||
|     patrolPlanId: { | |||
|       type: DataTypes.INTEGER, | |||
|       allowNull: false, | |||
|       defaultValue: null, | |||
|       comment: null, | |||
|       primaryKey: false, | |||
|       field: "patrol_plan_id", | |||
|       autoIncrement: false, | |||
|       references: { | |||
|         key: "id", | |||
|         model: "patrolPlan" | |||
|       } | |||
|     }, | |||
|     userId: { | |||
|       type: DataTypes.INTEGER, | |||
|       allowNull: false, | |||
|       defaultValue: null, | |||
|       comment: null, | |||
|       primaryKey: false, | |||
|       field: "user_id", | |||
|       autoIncrement: false, | |||
|       references: { | |||
|         key: "id", | |||
|         model: "user" | |||
|       } | |||
|     } | |||
|   }, { | |||
|     tableName: "patrol_plan_user", | |||
|     comment: "", | |||
|     indexes: [] | |||
|   }); | |||
|   dc.models.PatrolPlanUser = PatrolPlanUser; | |||
|   return PatrolPlanUser; | |||
| }; | |||
| @ -0,0 +1,2 @@ | |||
| ALTER TABLE "public"."patrol_plan"  | |||
|   DROP COLUMN "user_id"; | |||
| @ -0,0 +1,10 @@ | |||
| DROP TABLE IF EXISTS "public"."patrol_plan_user"; | |||
| CREATE TABLE "public"."patrol_plan_user" ( | |||
|   "id" serial, | |||
|   "patrol_plan_id" int4 NOT NULL, | |||
|   "user_id" int4 NOT NULL, | |||
|   PRIMARY KEY ("id"), | |||
|   CONSTRAINT "patrol_plan_user_patrol_plan_id_fk" FOREIGN KEY ("patrol_plan_id") REFERENCES "public"."patrol_plan" ("id"), | |||
|   CONSTRAINT "patrol_plan_user_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user" ("id") | |||
| ) | |||
| ; | |||
					Loading…
					
					
				
		Reference in new issue