1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-01 00:08:27 +01:00
unleash.unleash/src/migrations/20231123100052-drop-last-seen-foreign-key.js
Fredrik Strand Oseberg a8ea8d3fbe
Fix/clean last seen environments (#5402)
This PR addresses some cleanup related to removing the
useLastSeenRefactor flag:

* Added fallback last seen to the feature table last_seen_at column 
* Remove foreign key on environment since we can not guarantee that we
will get valid data in this field
* Add environments to cleanup function
* Add test for cleanup environments
2023-11-23 12:12:58 +01:00

17 lines
389 B
JavaScript

exports.up = function (db, cb) {
db.runSql(
`
ALTER TABLE last_seen_at_metrics DROP CONSTRAINT last_seen_at_metrics_environment_fkey;
`,
cb
);
};
exports.down = function (db, cb) {
db.runSql(
`
ALTER TABLE last_seen_at_metrics ADD CONSTRAINT last_seen_at_metrics_environment_fkey FOREIGN KEY (environment) REFERENCES environments(name);
`,
cb
);
};