Skip to content

Commit

Permalink
WIP: TopicInviteUser DB migration - citizenos/citizenos-fe#112
Browse files Browse the repository at this point in the history
  • Loading branch information
tiblu committed Nov 19, 2019
1 parent 9578e1b commit e36e5a7
Showing 1 changed file with 60 additions and 0 deletions.
60 changes: 60 additions & 0 deletions db/migrations/20191119124917-create-topic-invite-user.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
'use strict';

var _ = require('lodash');
const LEVELS = {
none: 'none', // Enables to override inherited permissions.
read: 'read',
edit: 'edit',
admin: 'admin'
};

module.exports = {
up: (queryInterface, Sequelize) => {
return queryInterface.createTable('TopicInviteUsers', {
id: {
type: Sequelize.UUID,
primaryKey: true,
allowNull: false,
defaultValue: Sequelize.UUIDV4
},
creatorId: {
type: Sequelize.UUID,
allowNull: false,
comment: 'User who created the invite.',
references: {
model: 'Users',
key: 'id'
}
},
userId: {
type: Sequelize.UUID,
allowNull: false,
comment: 'User who is invited.',
references: {
model: 'Users',
key: 'id'
}
},
topicId: {
type: Sequelize.UUID,
allowNull: false,
comment: 'Topic to which member belongs.',
references: {
model: 'Topics',
key: 'id'
},
primaryKey: true
},
level: {
type: Sequelize.ENUM,
values: _.values(LEVELS),
allowNull: false,
defaultValue: LEVELS.read,
comment: 'User membership level.'
}
});
},
down: (queryInterface) => {
return queryInterface.dropTable('TopicInviteUsers');
}
};

0 comments on commit e36e5a7

Please sign in to comment.