1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-01 00:08:27 +01:00
unleash.unleash/src/migrations/20230817095805-client-applications-usage-table.js
andreas-unleash 4ce6c96e04
feat: create client_applications_usage table migration (#4521)
Creates client_applications_usage table

---------

Signed-off-by: andreas-unleash <andreas@getunleash.ai>
2023-08-18 14:26:22 +03:00

25 lines
686 B
JavaScript

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