8000 Adding attribute-mapping capability in ZAP where 2 attributes can be linked to each other by brdandu · Pull Request #1314 · project-chip/zap · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Adding attribute-mapping capability in ZAP where 2 attributes can be linked to each other #1314

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

brdandu
Copy link
Collaborator
@brdandu brdandu commented May 1, 2024
  • updating zap schema with attribute mapping table

  • Updating the zcl-loader to load the multi-protocol.json file from the zcl.json file. See loadAttributeMappingForMultiProtocol function

  • Provide selectAttributeMappingsByPackageIds in query-attribute.js to retrieve attribute mapping info from packageIds given

  • Update query-loader with the insert query that updates the attribute mapping table

  • Add helper functions to check if multi-protocol is enabled and get all attribute mapping info from current session

  • Add tests for attribute mapping and multi-protocol enablement

  • JRIA: ZAPP-1315

@brdandu brdandu requested review from tecimovic and paulr34 May 1, 2024 19:29
@brdandu brdandu force-pushed the feature/syncingAttributeConfigs/ZAPP-1315 branch from 980a7e0 to 3033d59 Compare May 3, 2024 12:50
Copy link
Collaborator
@tecimovic tecimovic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apart from naming (which I left comment about in the review), my main question is:

The new table is just attribute junction. It doesn't have any links to the session or package or anything.

What deletes the entries in this table? How does the data get wiped out once the packages are unloaded or anything else happens?

Does a cascade delete of a package remove the entries from this table?

I just want to make sure we don't have a table that keeps growing forever...

DROP TABLE IF EXISTS "ATTRIBUTE_MAPPING";
CREATE TABLE IF NOT EXISTS "ATTRIBUTE_MAPPING" (
"ATTRIBUTE_MAPPING_ID" integer primary key autoincrement,
"ATTRIBUTE_REF_1" integer,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This name should end with _REF because that's our standard. We say: a field that ends with _REF is a foreign key. Here you have a field that ends with _REF_1 that is foreigh key.

I would call these:
ATTRIBUTE_LEFT_REF, ATTRIBUTE_RIGHT_REF

or ATTRIBUTE_1_REF and ATTRIBUTE_2_REF

But I would end the name with _REF.

const queryNotification = require('../db/query-session-notification')
const { protocol } = require('electron')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think the "require('electron')" is right here. Probably just some automatic junk, but it might include tons of crap you don't want.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch.

@brdandu
Copy link
Collaborator Author
brdandu commented May 3, 2024

Apart from naming (which I left comment about in the review), my main question is:

The new table is just attribute junction. It doesn't have any links to the session or package or anything.
Response: It has a reference to the package using the attribute_ref since the attribute refers to a package
What deletes the entries in this table? How does the data get wiped out once the packages are unloaded or anything else happens?
Response: The entries in the table get deleted if the attributes are deleted using the cascade delete.
Does a cascade delete of a package remove the entries from this table?

I just want to make sure we don't have a table that keeps growing forever...
Response: There is a checksum on the json file. Also there is a unique constraint on the 2 attribute ref combinations. Hence the insert and replace in the on attribute_mapping table.

…linked to each other

- updating zap schema with attribute mapping table
- Updating the zcl-loader to load the multi-protocol.json file from the zcl.json file. See loadAttributeMappingForMultiProtocol function
- Provide selectAttributeMappingsByPackageIds in query-attribute.js to retrieve attribute mapping info from packageIds given
- Update query-loader with the insert query that updates the attribute mapping table
- Add helper functions to check if multi-protocol is enabled and get all attribute mapping info from current session
- Add tests for attribute mapping and multi-protocol enablement
- Renaming of attribute mapping columns and minor cleanup
- Updating the schema
JIRA: ZAPP-1315
@brdandu brdandu force-pushed the feature/syncingAttributeConfigs/ZAPP-1315 branch from dd99e82 to b0256d2 Compare May 3, 2024 14:32
@brdandu brdandu merged commit 78977d3 into project-chip:master May 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0