diff --git a/app/migrations/20190917090318-add-composite-key-to-realEstates.js b/app/migrations/20190917090318-add-composite-key-to-realEstates.js new file mode 100644 index 0000000..feb84b2 --- /dev/null +++ b/app/migrations/20190917090318-add-composite-key-to-realEstates.js @@ -0,0 +1,21 @@ +"use strict"; + +module.exports = { + up: (queryInterface, Sequelize) => { + return queryInterface.addConstraint( + "RealEstates", + ["originAgencyName", "agencyObjectId"], + { + type: "unique", + name: "agencyNameObjectIdUniqueKey" + } + ); + }, + + down: (queryInterface, Sequelize) => { + return queryInterface.removeConstraint( + "RealEstates", + "agencyNameObjectIdUniqueKey" + ); + } +};