mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			39 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			39 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
/* 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);
 | 
						|
};
 |