Skip to content

Commit a958eaa

Browse files
committed
Change userId to integer type
1 parent 4ca55c2 commit a958eaa

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/TimeSeriesPanel.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ export const TimeSeriesPanel = ({
7979
const getTimescales = useCallback(async () => {
8080
const user = config.bootData.user;
8181
const userId = user?.id;
82-
const rawSql = `select min, max, metric from scales where user_id='${userId}' and well='${well}';`;
82+
const rawSql = `select min, max, metric from scales where user_id=${userId} and well='${well}';`;
8383
const target = data.request?.targets[0];
8484
const datasourceId = target?.datasource?.uid;
8585
const refId = target?.refId;
@@ -117,7 +117,7 @@ export const TimeSeriesPanel = ({
117117
const user = config.bootData.user;
118118
const userId = user?.id;
119119
const sanitizedDescription = description.replace(/\"|\'/g, '');
120-
const rawSql = `insert into scales values ('${well}', '${userId}', '${scale}', ${min}, ${max}, '${sanitizedDescription}') on conflict (well, user_id, metric) do update set min = excluded.min, max = excluded.max;`;
120+
const rawSql = `insert into scales values ('${well}', ${userId}, '${scale}', ${min}, ${max}, '${sanitizedDescription}') on conflict (well, user_id, metric) do update set min = excluded.min, max = excluded.max;`;
121121
const target = data.request?.targets[0];
122122
const datasourceId = target?.datasource?.uid;
123123
const refId = target?.refId;

timescale/init.sql

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ CREATE TABLE config (
3131

3232
CREATE TABLE scales (
3333
well text NOT NULL,
34-
user_id text NOT NULL,
34+
user_id integer NOT NULL,
3535
metric text NOT NULL,
3636
min DOUBLE PRECISION NULL,
3737
max DOUBLE PRECISION NULL,

0 commit comments

Comments
 (0)