hoffmation-base 3.0.0-beta.1 → 3.0.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -318,7 +318,7 @@ BEGIN
|
|
|
318
318
|
create table if not exists hoffmation_schema."Settings"
|
|
319
319
|
(
|
|
320
320
|
"id" varchar(60) not null,
|
|
321
|
-
"settings"
|
|
321
|
+
"settings" jsonb not null,
|
|
322
322
|
"customname" varchar(100) not null,
|
|
323
323
|
date timestamp not null,
|
|
324
324
|
constraint settings_pk
|
|
@@ -342,6 +342,12 @@ BEGIN
|
|
|
342
342
|
alter table hoffmation_schema."EnergyCalculation"
|
|
343
343
|
add "batteryLevel" double precision;
|
|
344
344
|
END IF;
|
|
345
|
+
IF (SELECT pg_typeof(settings) = to_regtype('varchar')
|
|
346
|
+
FROM hoffmation_schema."Settings"
|
|
347
|
+
LIMIT 1) THEN
|
|
348
|
+
alter table hoffmation_schema."Settings"
|
|
349
|
+
alter column settings type jsonb using settings::jsonb;
|
|
350
|
+
END IF;
|
|
345
351
|
END
|
|
346
352
|
$$;`);
|
|
347
353
|
this.initialized = true;
|
|
@@ -477,7 +483,7 @@ values ('${id}','${settings}','${customName}', '${new Date().toISOString()}')
|
|
|
477
483
|
}
|
|
478
484
|
/** @inheritDoc */
|
|
479
485
|
async loadSettings(id) {
|
|
480
|
-
const dbResult = await this.query(`SELECT settings, id, date
|
|
486
|
+
const dbResult = await this.query(`SELECT settings::text, id, date
|
|
481
487
|
from hoffmation_schema."Settings"
|
|
482
488
|
WHERE "id" = '${id}'
|
|
483
489
|
ORDER BY "date" DESC
|