1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-22 19:07:54 +01:00
unleash.unleash/src/migrations/20231003113443-last-seen-at-metrics-table.js
Fredrik Strand Oseberg d896dbd0c7
Fix/last seen at by environment (#4939)
Initial architecture for last seen at by environment.
2023-10-09 10:54:00 +02:00

27 lines
629 B
JavaScript

'use strict';
exports.up = function (db, callback) {
db.runSql(
`
CREATE TABLE last_seen_at_metrics (
feature_name VARCHAR(255),
environment VARCHAR(100),
last_seen_at TIMESTAMP WITH TIME ZONE NOT NULL,
PRIMARY KEY (feature_name, environment),
FOREIGN KEY (environment) REFERENCES environments(name) ON DELETE CASCADE
);
CREATE INDEX idx_feature_name
ON last_seen_at_metrics (feature_name);`,
callback(),
);
};
exports.down = function (db, callback) {
db.runSql(
`DROP TABLE last_seen_at_metrics;
`,
callback(),
);
};