Files
outline/server/migrations/20170604052347-add-stars.js
Jori Lallo b64e47f42a Circle CI (#113)
Circle CI
2017-07-08 21:13:47 -07:00

40 lines
932 B
JavaScript

module.exports = {
up: function(queryInterface, Sequelize) {
queryInterface
.createTable('stars', {
id: {
type: Sequelize.UUID,
allowNull: false,
primaryKey: true,
},
documentId: {
type: Sequelize.UUID,
allowNull: false,
},
userId: {
type: Sequelize.UUID,
allowNull: false,
},
createdAt: {
type: Sequelize.DATE,
allowNull: false,
},
updatedAt: {
type: Sequelize.DATE,
allowNull: false,
},
})
.then(() => {
queryInterface.addIndex('stars', ['documentId', 'userId'], {
indicesType: 'UNIQUE',
});
});
},
down: function(queryInterface, Sequelize) {
queryInterface.removeIndex('stars', ['documentId', 'userId']).then(() => {
queryInterface.dropTable('stars');
});
},
};