mirror of
https://github.com/pawelmalak/flame.git
synced 2025-07-19 19:49:37 +02:00
Modified models to support resource visibility. Added migration
This commit is contained in:
parent
08afaece2e
commit
ee9aefa4fa
4 changed files with 114 additions and 60 deletions
27
db/migrations/02_resource-access.js
Normal file
27
db/migrations/02_resource-access.js
Normal file
|
@ -0,0 +1,27 @@
|
|||
const { DataTypes } = require('sequelize');
|
||||
const { INTEGER } = DataTypes;
|
||||
|
||||
const tables = ['categories', 'bookmarks', 'apps'];
|
||||
|
||||
const up = async (query) => {
|
||||
const template = {
|
||||
type: INTEGER,
|
||||
allowNull: true,
|
||||
defaultValue: 0,
|
||||
};
|
||||
|
||||
for await (let table of tables) {
|
||||
await query.addColumn(table, 'isPublic', template);
|
||||
}
|
||||
};
|
||||
|
||||
const down = async (query) => {
|
||||
for await (let table of tables) {
|
||||
await query.removeColumn(table, 'isPublic');
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
up,
|
||||
down,
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue