1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-28 00:06:53 +01:00
unleash.unleash/src/migrations/20210907124850-add-dbcritic-primary-keys.js
Christopher Kolstad 561c3d22e9
fix: Added indices and primary key to feature_tag (#936)
* fix: Added indices and primary key as recommended by dbcritic
2021-09-10 12:27:20 +02:00

26 lines
643 B
JavaScript

exports.up = function (db, cb) {
db.runSql(
`
ALTER TABLE feature_tag
DROP CONSTRAINT feature_tag_feature_name_tag_type_tag_value_key;
ALTER TABLE feature_tag
ADD PRIMARY KEY (feature_name, tag_type, tag_value);
`,
cb,
);
};
exports.down = function (db, cb) {
db.runSql(
`ALTER TABLE feature_tag
DROP constraint feature_tag_pkey;
ALTER TABLE feature_tag
ADD CONSTRAINT feature_tag_feature_name_tag_type_tag_value_key UNIQUE (feature_name, tag_type, tag_value)`,
cb,
);
};
exports._meta = {
version: 1,
};