Files
cloudron-box/migrations/20180615041128-groups-add-rolesJson.js
Girish Ramakrishnan a77d45f5de Add rolesJson to groups table
This will contain the roles ('role definition') of a group of
users. We will internally map these to our API scopes.
2018-06-14 22:54:52 -07:00

20 lines
592 B
JavaScript

'use strict';
var async = require('async');
exports.up = function(db, callback) {
async.series([
db.runSql.bind(db, 'START TRANSACTION;'),
db.runSql.bind(db, 'ALTER TABLE groups ADD COLUMN rolesJson TEXT'),
db.runSql.bind(db, 'UPDATE groups SET rolesJson=? WHERE id=?', JSON.stringify([ 'owner' ]), 'admin'),
db.runSql.bind(db, 'COMMIT')
], callback);
};
exports.down = function(db, callback) {
db.runSql('ALTER TABLE groups DROP COLUMN rolesJson', function (error) {
if (error) console.error(error);
callback(error);
});
};