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

27 lines
629 B
JavaScript
Raw Normal View History

'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(),
);
};