diff --git a/src-electron/db/query-zcl.js b/src-electron/db/query-zcl.js index ff97a11c13..394f7aaefc 100644 --- a/src-electron/db/query-zcl.js +++ b/src-electron/db/query-zcl.js @@ -1624,6 +1624,24 @@ async function insertDomains(db, packageId, data) { * @returns Promise of insertion. */ async function insertSpecs(db, packageId, data) { + let olders = [] + data.forEach((domain) => { + if ('older' in domain) { + domain.older.forEach((older) => olders.push(older)) + } + }) + if (olders.length > 0) { + await dbApi.dbMultiInsert( + db, + 'INSERT INTO SPEC (PACKAGE_REF, CODE, DESCRIPTION, CERTIFIABLE) VALUES (?, ?, ?, ?)', + olders.map((older) => [ + packageId, + older.specCode, + older.specDescription, + older.specCertifiable ? 1 : 0, + ]) + ) + } return dbApi.dbMultiInsert( db, 'INSERT INTO SPEC (PACKAGE_REF, CODE, DESCRIPTION, CERTIFIABLE) VALUES (?, ?, ?, ?)', diff --git a/test/zcl-loader.test.js b/test/zcl-loader.test.js index 91049c60d9..0f75640b16 100644 --- a/test/zcl-loader.test.js +++ b/test/zcl-loader.test.js @@ -87,7 +87,7 @@ test('test Silabs zcl data loading in memory', () => { .then(() => queryGeneric.selectCountFrom(db, 'GLOBAL_ATTRIBUTE_DEFAULT')) .then((x) => expect(x).toEqual(126)) .then(() => queryGeneric.selectCountFrom(db, 'SPEC')) - .then((x) => expect(x).toEqual(22)) + .then((x) => expect(x).toEqual(38)) .then(() => dbApi.dbAll( db,