add migrations for new DB design

This commit is contained in:
Bilal Catic
2019-09-13 09:46:59 +02:00
parent 05f8cbd816
commit 75daf55fdf
3 changed files with 169 additions and 0 deletions

View File

@@ -0,0 +1,45 @@
"use strict";
module.exports = {
up: (queryInterface, Sequelize) => {
const tableFields = {
id: {
type: Sequelize.BIGINT,
autoIncrement: true,
allowNull: false
},
searchRequestId: {
type: Sequelize.UUID,
allowNull: false,
primaryKey: true,
references: {
model: "searchRequests",
key: "id"
},
onUpdate: "CASCADE",
onDelete: "SET NULL"
},
realEstateId: {
type: Sequelize.BIGINT,
allowNull: false,
primaryKey: true,
references: {
model: "realEstates",
key: "id"
},
onUpdate: "CASCADE",
onDelete: "SET NULL"
},
notified: {
type: Sequelize.BOOLEAN,
allowNull: false,
defaultValue: false
}
};
return queryInterface.createTable("searchRequestMatches", tableFields);
},
down: queryInterface => {
return queryInterface.dropTable("searchRequestMatches", {});
}
};