1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-10-18 20:09:08 +02:00
unleash.unleash/migrations/20200805091409-add-feature-toggle-type.js

39 lines
1.6 KiB
JavaScript
Raw Normal View History

/* eslint camelcase: "off" */
'use strict';
const async = require('async');
exports.up = function(db, cb) {
async.series(
[
db.createTable.bind(db, 'feature_types', {
id: {
type: 'string',
length: 255,
primaryKey: true,
notNull: true,
},
name: { type: 'string', notNull: true },
description: { type: 'string' },
lifetime_days: { type: 'int' },
}),
db.runSql.bind(
db,
`
INSERT INTO feature_types(id, name, description, lifetime_days) VALUES('release', 'Release', 'Used to enable trunk-based development for teams practicing Continuous Delivery.', 40);
INSERT INTO feature_types(id, name, description, lifetime_days) VALUES('experiment', 'Experiment', 'Used to perform multivariate or A/B testing.', 40);
INSERT INTO feature_types(id, name, description, lifetime_days) VALUES('operational', 'Operational', 'Used to control operational aspects of the system behavior.', 7);
INSERT INTO feature_types(id, name, description, lifetime_days) VALUES('kill-switch', 'Kill switch', 'Used to to gracefully degrade system functionality.', null);
INSERT INTO feature_types(id, name, description, lifetime_days) VALUES('permission', 'Permission', 'Used to change the features or product experience that certain users receive.', null);
`,
),
],
cb,
);
};
exports.down = function(db, cb) {
return db.dropTable('feature_types', cb);
};