diff --git a/src/database/migrations/drop_all_but_users.js b/src/database/migrations/20190101_drop_all_but_users.js similarity index 100% rename from src/database/migrations/drop_all_but_users.js rename to src/database/migrations/20190101_drop_all_but_users.js diff --git a/src/database/migrations/20190113_fix_accessgroups.js b/src/database/migrations/20190113_fix_accessgroups.js index e85777a717..6f04aec276 100644 --- a/src/database/migrations/20190113_fix_accessgroups.js +++ b/src/database/migrations/20190113_fix_accessgroups.js @@ -11,4 +11,4 @@ module.exports = { }, down: async () => { } -} \ No newline at end of file +} diff --git a/src/database/migrations/20190121_seed_accessgroups.js b/src/database/migrations/20190121_seed_accessgroups.js new file mode 100644 index 0000000000..e21741cbb8 --- /dev/null +++ b/src/database/migrations/20190121_seed_accessgroups.js @@ -0,0 +1,19 @@ +const { AccessGroup, User } = require('../../models') +defaultAccessGroups = [ + { + group_code: 'teachers', + group_info: 'grants access to teacher statistics', + }, + { + group_code: 'admin', + group_info: 'grants access to everything' + } +] +module.exports = { + up: async (queryInterface, Sequelize) => { + AccessGroup.bulkCreate(defaultAccessGroups) + }, + down: async () => { + AccessGroup.destroy({ where: { group_code: ['teachers', 'admin'] } }) + } +} \ No newline at end of file