Skip to content

Commit

Permalink
fix: metric counters should use bigint (#1313)
Browse files Browse the repository at this point in the history
  • Loading branch information
ivarconr committed Jan 31, 2022
1 parent fe0c35c commit 19cb991
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lib/db/client-metrics-store-v2.ts
Expand Up @@ -24,8 +24,8 @@ const fromRow = (row: ClientMetricsEnvTable) => ({
appName: row.app_name,
environment: row.environment,
timestamp: row.timestamp,
yes: row.yes,
no: row.no,
yes: Number(row.yes),
no: Number(row.no),
});

const toRow = (metric: IClientMetricsEnv) => ({
Expand Down
23 changes: 23 additions & 0 deletions src/migrations/20220129113106-metrics-counters-as-bigint.js
@@ -0,0 +1,23 @@
'use strict';

exports.up = function (db, cb) {
db.runSql(
`
ALTER TABLE client_metrics_env
ALTER COLUMN yes TYPE BIGINT,
ALTER COLUMN no TYPE BIGINT;
`,
cb,
);
};

exports.down = function (db, cb) {
db.runSql(
`
ALTER TABLE client_metrics_env
ALTER COLUMN yes TYPE INTEGER,
ALTER COLUMN no TYPE INTEGER;
`,
cb,
);
};

0 comments on commit 19cb991

Please sign in to comment.