From 62361847f5387a36fdf067b5d92af73e5b21842e Mon Sep 17 00:00:00 2001 From: andreas-unleash Date: Tue, 5 Mar 2024 10:51:32 +0200 Subject: [PATCH] Feat: add enviroment type trends table (#6432) Creates the environment_type_trends table to store aggregated metrics Closes: # [1-2124](https://linear.app/unleash/issue/1-2124/create-the-table-to-store-weekly-aggregation) Signed-off-by: andreas-unleash --- ...240304160659-add-environment-type-trends.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/migrations/20240304160659-add-environment-type-trends.js diff --git a/src/migrations/20240304160659-add-environment-type-trends.js b/src/migrations/20240304160659-add-environment-type-trends.js new file mode 100644 index 0000000000..9ccd53c9e6 --- /dev/null +++ b/src/migrations/20240304160659-add-environment-type-trends.js @@ -0,0 +1,18 @@ +'use strict'; + +exports.up = function(db, cb) { + db.runSql( + ` + CREATE TABLE IF NOT EXISTS environment_type_trends ( + id VARCHAR(255) NOT NULL, + environment_type VARCHAR(255) NOT NULL, + total_updates INTEGER NOT NULL, + PRIMARY KEY (id, environment_type) + );`, + cb, + ); +}; + +exports.down = function(db, cb) { + db.runSql('DROP TABLE IF EXISTS environment_type_trends;', cb); +};