@balena/open-balena-api 31.2.1-build-backfill-service-device-on-dsev-3290255fe221136744ba516983a8cb4cf182cef6-1 → 31.2.1-build-add-service-idx-on-dsev-003ffcd306a3e3b20fc693a6071f0c9bf65f38b2-1
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/balena-init.sql +7 -0
- package/dist/migrations/00096-add-service-index-on-dsev-fkey.sql +10 -0
- package/package.json +2 -2
- package/dist/migrations/00096-backfill-device-service-on-device-service-environment-variable.async.d.ts +0 -3
- package/dist/migrations/00096-backfill-device-service-on-device-service-environment-variable.async.js +0 -34
- package/dist/migrations/00096-backfill-device-service-on-device-service-environment-variable.async.js.map +0 -1
package/dist/balena-init.sql
CHANGED
@@ -81,6 +81,13 @@ ON "device family" ("is manufactured by-device manufacturer");
|
|
81
81
|
|
82
82
|
-- "device tag"."device" is the first part of an automated unique index
|
83
83
|
|
84
|
+
-- "device environment variable"."device" is created with the unique index
|
85
|
+
CREATE UNIQUE INDEX IF NOT EXISTS "device service environment variable_device_service_name_key"
|
86
|
+
ON "device service environment variable" ("device", "service", "name");
|
87
|
+
|
88
|
+
CREATE INDEX IF NOT EXISTS "device_service_environment_variable_service_idx"
|
89
|
+
ON "device service environment variable" ("service");
|
90
|
+
|
84
91
|
CREATE INDEX IF NOT EXISTS "device_type_cpu_arch_idx"
|
85
92
|
ON "device type" ("is of-cpu architecture");
|
86
93
|
CREATE INDEX IF NOT EXISTS "device_type_device_family_idx"
|
@@ -0,0 +1,10 @@
|
|
1
|
+
-- This is duplicated (from 00095 migration) because it was added the
|
2
|
+
-- first time without balena-init.sql file being updated to have it
|
3
|
+
CREATE UNIQUE INDEX IF NOT EXISTS "device service environment variable_device_service_name_key"
|
4
|
+
ON "device service environment variable" ("device", "service", "name");
|
5
|
+
|
6
|
+
-- Index is needed for "service" only as we need all FKs to have
|
7
|
+
-- at least one index where they are the first column in the index
|
8
|
+
-- For the "device" FK, it is already the first column in the unique index
|
9
|
+
CREATE INDEX IF NOT EXISTS "device_service_environment_variable_service_idx"
|
10
|
+
ON "device service environment variable" ("service");
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@balena/open-balena-api",
|
3
3
|
"description": "Internet of things, Made Simple",
|
4
|
-
"version": "31.2.1-build-
|
4
|
+
"version": "31.2.1-build-add-service-idx-on-dsev-003ffcd306a3e3b20fc693a6071f0c9bf65f38b2-1",
|
5
5
|
"license": "AGPL-3.0",
|
6
6
|
"repository": {
|
7
7
|
"type": "git",
|
@@ -166,6 +166,6 @@
|
|
166
166
|
"loader": "ts-node/esm/transpile-only"
|
167
167
|
},
|
168
168
|
"versionist": {
|
169
|
-
"publishedAt": "2024-11-
|
169
|
+
"publishedAt": "2024-11-18T11:57:01.341Z"
|
170
170
|
}
|
171
171
|
}
|
@@ -1,34 +0,0 @@
|
|
1
|
-
const migration = {
|
2
|
-
asyncSql: `\
|
3
|
-
UPDATE "device service environment variable" AS dsev
|
4
|
-
SET
|
5
|
-
"device" = si."device",
|
6
|
-
"service" = si."installs-service"
|
7
|
-
FROM "service install" AS si
|
8
|
-
WHERE dsev."service install" = si."id"
|
9
|
-
AND dsev.id IN (
|
10
|
-
SELECT id
|
11
|
-
FROM "device service environment variable"
|
12
|
-
WHERE ( "device" IS NULL OR "service" IS NULL )
|
13
|
-
FOR UPDATE SKIP LOCKED
|
14
|
-
LIMIT %%ASYNC_BATCH_SIZE%%
|
15
|
-
);
|
16
|
-
`,
|
17
|
-
syncSql: `\
|
18
|
-
UPDATE "device service environment variable" AS dsev
|
19
|
-
SET
|
20
|
-
"device" = si."device",
|
21
|
-
"service" = si."installs-service"
|
22
|
-
FROM "service install" AS si
|
23
|
-
WHERE
|
24
|
-
dsev."service install" = si."id"
|
25
|
-
AND (dsev."device" IS NULL OR dsev."service" IS NULL);
|
26
|
-
`,
|
27
|
-
asyncBatchSize: 5000,
|
28
|
-
delayMS: 60000,
|
29
|
-
backoffDelayMS: 120000,
|
30
|
-
errorThreshold: 10,
|
31
|
-
finalize: true,
|
32
|
-
};
|
33
|
-
export default migration;
|
34
|
-
//# sourceMappingURL=00096-backfill-device-service-on-device-service-environment-variable.async.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"00096-backfill-device-service-on-device-service-environment-variable.async.js","sourceRoot":"","sources":["../../src/migrations/00096-backfill-device-service-on-device-service-environment-variable.async.ts"],"names":[],"mappings":"AAEA,MAAM,SAAS,GAA4B;IAC1C,QAAQ,EAAE;;;;;;;;;;;;;;EAcT;IACD,OAAO,EAAE;;;;;;;;;EASR;IACD,cAAc,EAAE,IAAI;IACpB,OAAO,EAAE,KAAK;IACd,cAAc,EAAE,MAAM;IACtB,cAAc,EAAE,EAAE;IAClB,QAAQ,EAAE,IAAI;CACd,CAAC;AAEF,eAAe,SAAS,CAAC"}
|