1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-06 00:07:44 +01:00
unleash.unleash/src/migrations/20230125065315-project-stats-table.js
Fredrik Strand Oseberg 4ea4bcfaf4
fix: down migration (#3015)
* Fixes broken down migration
2023-01-27 16:13:59 +01:00

29 lines
923 B
JavaScript

exports.up = function (db, cb) {
db.runSql(
`CREATE TABLE IF NOT EXISTS project_stats (
project VARCHAR(255) NOT NULL,
avg_time_to_prod_current_window FLOAT DEFAULT 0,
avg_time_to_prod_past_window FLOAT DEFAULT 0,
project_changes_current_window INTEGER DEFAULT 0,
project_changes_past_window INTEGER DEFAULT 0,
features_created_current_window INTEGER DEFAULT 0,
features_created_past_window INTEGER DEFAULT 0,
features_archived_current_window INTEGER DEFAULT 0,
features_archived_past_window INTEGER DEFAULT 0,
FOREIGN KEY (project) references projects(id) ON DELETE CASCADE,
UNIQUE(project)
);
`,
cb,
);
};
exports.down = function (db, cb) {
db.runSql(
`
DROP TABLE project_stats;
`,
cb,
);
};