1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-06 00:07:44 +01:00
unleash.unleash/src/migrations/20230919104006-dependent-features.js
2023-09-19 13:01:38 +02:00

29 lines
755 B
JavaScript

'use strict';
exports.up = function (db, cb) {
db.runSql(
`
CREATE TABLE IF NOT EXISTS dependent_features
(
parent varchar(255) NOT NULL,
child varchar(255) NOT NULL,
enabled boolean DEFAULT true NOT NULL,
variants JSONB DEFAULT '[]'::jsonb NOT NULL,
PRIMARY KEY (parent, child),
FOREIGN KEY (parent) REFERENCES features (name) ON DELETE RESTRICT,
FOREIGN KEY (child) REFERENCES features (name) ON DELETE CASCADE
);
`,
cb(),
);
};
exports.down = function (db, cb) {
db.runSql(
`
DROP TABLE dependent_features;
`,
cb,
);
};