Built motion from commit 1333b3551.|1.0.38
[motion.git] / server / migrations / 20160419112635-modules.js
1 'use strict';
2
3 module.exports = {
4   up: function(queryInterface, Sequelize) {
5     queryInterface.addColumn('modules', 'ModuleId', Sequelize.INTEGER);
6     queryInterface.removeIndex('modules', 'name');
7     queryInterface.sequelize.query("ALTER TABLE modules ADD CONSTRAINT modules_ibfk_1 FOREIGN KEY (ModuleId) REFERENCES motion.modules(id) ON DELETE SET NULL ON UPDATE CASCADE;");
8
9   },
10
11   down: function(queryInterface, Sequelize) {
12     queryInterface.removeColumn('modules', 'ModuleId');
13     queryInterface.addIndex(
14       'modules', ['name'], {
15         indexName: 'name',
16         indicesType: 'UNIQUE'
17       }
18     );
19     queryInterface.sequelize.query('ALTER TABLE modules DROP CONSTRAINT modules_ibfk_1;');
20   }
21 };