1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-05-12 01:17:04 +02:00

feat: flag trends db migration (#6044)

This commit is contained in:
Mateusz Kwasniewski 2024-01-26 14:37:15 +01:00 committed by GitHub
parent 61c6583e24
commit a1fa5a4212
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -0,0 +1,21 @@
'use strict';
exports.up = function(db, cb) {
db.runSql(
`
CREATE TABLE IF NOT EXISTS flag_trends (
id VARCHAR(255) NOT NULL,
project VARCHAR(255) NOT NULL REFERENCES projects (id) ON DELETE CASCADE,
total_flags INTEGER NOT NULL,
stale_flags INTEGER NOT NULL,
potentially_stale_flags INTEGER NOT NULL,
created_at TIMESTAMP default now(),
PRIMARY KEY (id, project)
);`,
cb,
);
};
exports.down = function(db, cb) {
db.runSql('DROP TABLE IF EXISTS flag_trends;', cb);
};