gancio-upstream/server/migrations/20191025145516-followers.js
2019-10-28 17:33:20 +01:00

35 lines
842 B
JavaScript

'use strict'
module.exports = {
up: (queryInterface, Sequelize) => {
return queryInterface.createTable('user_followers', {
userId: {
type: Sequelize.INTEGER,
references: {
model: 'users',
key: 'id'
},
primaryKey: true,
allowNull: false,
onUpdate: 'CASCADE',
onDelete: 'CASCADE'
},
fedUserApId: {
primaryKey: true,
type: Sequelize.STRING,
references: {
model: 'fed_users',
key: 'ap_id'
},
onUpdate: 'CASCADE',
onDelete: 'CASCADE'
},
createdAt: { type: Sequelize.DATE, allowNull: false },
updatedAt: { type: Sequelize.DATE, allowNull: false }
})
},
down: (queryInterface, Sequelize) => {
return queryInterface.dropTable('user_followers')
}
}