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

Add log message for entities without primary_key, update README.rb #87

Merged
merged 1 commit into from
Sep 27, 2023

Conversation

ericaporter
Copy link
Contributor

@ericaporter ericaporter commented Sep 27, 2023

dfe-analytics does not load entities if they do not have a primary key. This issue was discovered when ECF (CPD) were installing the gem and were unable to load a join table which did not have a primary key.

It was decided to update the error messaging / readme to ask that a primary key to be added to the entity in these situations.

This PR includes these additions (1. update to logging message 2. update to README.rb)

Updates to the loading strategy, to make it more robust, will be considered in future.

@ericaporter ericaporter requested a review from asatwal September 27, 2023 12:53
Copy link
Collaborator

@asatwal asatwal left a comment

Choose a reason for hiding this comment

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

👍 Looks Good.

primary_key = model.primary_key

if primary_key.nil?
Rails.logger.info("Not processing #{@entity_name} as it does not have a primary key")
Copy link
Collaborator

Choose a reason for hiding this comment

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

👍

@ericaporter ericaporter merged commit 1779cfb into main Sep 27, 2023
@ericaporter ericaporter deleted the loading-join-tables-without-ids branch September 27, 2023 14:27
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