fix #18, cache users from fediverse

This commit is contained in:
les
2019-09-12 14:59:51 +02:00
parent fca3b8739d
commit cf5c09e3b1
9 changed files with 158 additions and 34 deletions

View File

@@ -0,0 +1,47 @@
'use strict';
module.exports = {
up: (queryInterface, Sequelize) => {
return Promise.all([
queryInterface.removeColumn('users', 'followers'),
queryInterface.createTable('user_followers', {
userId: {
type: Sequelize.INTEGER,
references: {
model: 'users',
key: 'id'
},
primaryKey: true,
allowNull: false
},
fedUserApId: {
primaryKey: true,
type: Sequelize.STRING,
references: {
model: 'fed_users',
key: 'ap_id'
}
},
createdAt: { type: Sequelize.DATE, allowNull: false },
updatedAt: { type: Sequelize.DATE, allowNull: false }
})
])},
down: (queryInterface, Sequelize) => {
return Promise.all([
queryInterface.addColumn(
'users', 'followers', {
type: JSON,
defaultValue: []
}),
queryInterface.dropTable('user_followers')
])
/*
Add reverting commands here.
Return a promise to correctly handle asynchronicity.
Example:
return queryInterface.dropTable('users');
*/
}
};