From 4ce6c96e04b7014d239fb5b6ee57567c81c3d347 Mon Sep 17 00:00:00 2001 From: andreas-unleash Date: Fri, 18 Aug 2023 14:26:22 +0300 Subject: [PATCH] feat: create client_applications_usage table migration (#4521) Creates client_applications_usage table --------- Signed-off-by: andreas-unleash --- ...7095805-client-applications-usage-table.js | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/migrations/20230817095805-client-applications-usage-table.js diff --git a/src/migrations/20230817095805-client-applications-usage-table.js b/src/migrations/20230817095805-client-applications-usage-table.js new file mode 100644 index 000000000000..64b095e3ab21 --- /dev/null +++ b/src/migrations/20230817095805-client-applications-usage-table.js @@ -0,0 +1,24 @@ +'use strict'; + +exports.up = function (db, callback) { + db.runSql( + ` + CREATE TABLE IF NOT EXISTS client_applications_usage ( + app_name VARCHAR(255) REFERENCES client_applications(app_name) ON DELETE CASCADE, + project VARCHAR(255) REFERENCES projects(id) ON DELETE CASCADE, + environment VARCHAR(100) REFERENCES environments(name) ON DELETE CASCADE, + PRIMARY KEY(app_name, project, environment) + ) ; + `, + callback, + ); +}; + +exports.down = function (db, callback) { + db.runSql( + ` + DROP TABLE IF EXISTS client_applications_usage; + `, + callback, + ); +};