Skip to content

Commit edd03d0

Browse files
authored
task: add status_code to edge traffic table to store 304s as well (#9312)
1 parent aafacc6 commit edd03d0

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
exports.up = (db, cb) => {
2+
db.runSql(`
3+
ALTER TABLE stat_edge_traffic_usage ADD COLUMN status_code INT NOT NULL DEFAULT 200;
4+
CREATE INDEX stat_edge_traffic_usage_traffic_group_status_code_idx ON stat_edge_traffic_usage(status_code, traffic_group);
5+
ALTER TABLE stat_edge_traffic_usage
6+
DROP CONSTRAINT stat_edge_traffic_usage_pkey,
7+
ADD PRIMARY KEY (instance_id, traffic_group, day, status_code);
8+
`, cb);
9+
};
10+
11+
exports.down = (db, cb) => {
12+
db.runSql(`
13+
ALTER TABLE stat_edge_traffic_usage DROP CONSTRAINT stat_edge_traffic_usage_pkey;
14+
DROP INDEX IF EXISTS stat_edge_traffic_usage_traffic_group_status_code_idx;
15+
ALTER TABLE stat_edge_traffic_usage DROP COLUMN status_code;
16+
ALTER TABLE stat_edge_traffic_usage ADD PRIMARY KEY (instance_id, traffic_group, day);
17+
`, cb);
18+
};

0 commit comments

Comments
 (0)