Skip to content
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

Updating metadata service model definitions to use camelCase #468

Merged
merged 1 commit into from
Nov 1, 2023

Conversation

deasydoesit
Copy link
Contributor

With underscored model attributes, usage of camelCase queries was prevented leading to errors like column key_to_assets.entityKey does not exist when using the following access pattern:

KeyToAsset.findOne({
  where: {
    entityKey: bs58.decode(eccCompact),
  },
  include: [IotHotspotInfo, MobileHotspotInfo],
});

Per the following excerpt from Sequelize docs, since we're using the underscored option during model init, we don't need to provide snake case model attributes.

With the underscored option enabled, Sequelize will instead define:

- A createdAt attribute for each model, pointing to a column named created_at in each table
- An updatedAt attribute for each model, pointing to a column named updated_at in each table
- A userId attribute in the Task model, pointing to a column named user_id in the task table

https://sequelize.org/docs/v6/other-topics/naming-strategies/#the-underscored-option

@deasydoesit deasydoesit merged commit 478afe7 into develop Nov 1, 2023
33 checks passed
@deasydoesit deasydoesit deleted the bugfix/metadata-service branch November 1, 2023 21:01
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.

2 participants