1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-01 00:08:27 +01:00
unleash.unleash/src/migrations/20230504145945-variant-metrics.js
2023-05-05 11:10:54 +03:00

39 lines
1.1 KiB
JavaScript

'use strict';
exports.up = function (db, callback) {
db.runSql(
`
CREATE TABLE IF NOT EXISTS client_metrics_env_variants (
feature_name VARCHAR(255),
app_name VARCHAR(255),
environment VARCHAR(100),
timestamp TIMESTAMP WITH TIME ZONE,
variant text,
count INTEGER DEFAULT 0,
FOREIGN KEY (
feature_name, app_name, environment,
timestamp
) REFERENCES client_metrics_env (
feature_name, app_name, environment,
timestamp
) ON UPDATE CASCADE ON DELETE CASCADE,
PRIMARY KEY(
feature_name, app_name, environment,
timestamp, variant
)
);
`,
callback,
);
};
exports.down = function (db, callback) {
db.runSql(
`
DROP TABLE IF EXISTS client_metrics_env_variants;
`,
callback,
);
};