1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-05-31 01:16:01 +02:00

task: add status_code to edge traffic table to store 304s as well (#9312)

This commit is contained in:
Christopher Kolstad 2025-02-14 14:52:45 +01:00 committed by GitHub
parent aafacc68cf
commit edd03d02dd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -0,0 +1,18 @@
exports.up = (db, cb) => {
db.runSql(`
ALTER TABLE stat_edge_traffic_usage ADD COLUMN status_code INT NOT NULL DEFAULT 200;
CREATE INDEX stat_edge_traffic_usage_traffic_group_status_code_idx ON stat_edge_traffic_usage(status_code, traffic_group);
ALTER TABLE stat_edge_traffic_usage
DROP CONSTRAINT stat_edge_traffic_usage_pkey,
ADD PRIMARY KEY (instance_id, traffic_group, day, status_code);
`, cb);
};
exports.down = (db, cb) => {
db.runSql(`
ALTER TABLE stat_edge_traffic_usage DROP CONSTRAINT stat_edge_traffic_usage_pkey;
DROP INDEX IF EXISTS stat_edge_traffic_usage_traffic_group_status_code_idx;
ALTER TABLE stat_edge_traffic_usage DROP COLUMN status_code;
ALTER TABLE stat_edge_traffic_usage ADD PRIMARY KEY (instance_id, traffic_group, day);
`, cb);
};