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 reference to central entities table in EEA #4191

Merged
merged 2 commits into from
Aug 19, 2024
Merged

Conversation

JAORMX
Copy link
Contributor

@JAORMX JAORMX commented Aug 19, 2024

Summary

This adds a nullable reference to the central entities table in the EEA
tables. This will simplify the EEA as we won't need to check multiple
tables anymore. However, we can't just migrate to it in one go; we need
to first duplicate the data then do it.

Closes: #4167

Change Type

Mark the type of change your PR introduces:

  • Bug fix (resolves an issue without affecting existing features)
  • Feature (adds new functionality without breaking changes)
  • Breaking change (may impact existing functionalities or require documentation updates)
  • Documentation (updates or additions to documentation)
  • Refactoring or test improvements (no bug fixes or new functionality)

Testing

Outline how the changes were tested, including steps to reproduce and any relevant configurations.
Attach screenshots if helpful.

Review Checklist:

  • Reviewed my own code for quality and clarity.
  • Added comments to complex or tricky code sections.
  • Updated any affected documentation.
  • Included tests that validate the fix or feature.
  • Checked that related changes are merged.

@JAORMX JAORMX requested a review from a team as a code owner August 19, 2024 06:38
@JAORMX JAORMX marked this pull request as draft August 19, 2024 06:38
This adds a nullable reference to the central entities table in the EEA
tables. This will simplify the EEA as we won't need to check multiple
tables anymore. However, we can't just migrate to it in one go; we need
to first duplicate the data then do it.

Signed-off-by: Juan Antonio Osorio <[email protected]>
@JAORMX JAORMX force-pushed the eea-entity-instance-in branch from 9e357ca to 3d5d368 Compare August 19, 2024 06:42
@coveralls
Copy link

coveralls commented Aug 19, 2024

Coverage Status

coverage: 53.891% (-0.008%) from 53.899%
when pulling d036e41 on eea-entity-instance-in
into 02a42be on main.

ArtifactID: artifactID,
PullRequestID: pullRequestID,
ProjectID: projectID,
Entity: entities.EntityTypeToDB(inf.Type),
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you plan to get rid of the type field in a future PR? (I know removing this requires a few steps to avoid breaking backwards compatibility)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right, type won't be needed in the future since the type won't matter. We'd be able to solely rely on the entity instance ID.

This PR merely duplicates info and is not making any logic moves yet.

return uuid.Nil, fmt.Errorf("no entity ID found")
}

func (eiw *EntityInfoWrapper) getIDForEntityType(t minderv1.Entity) (uuid.UUID, bool) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess you could make the methods simpler by making getIDForEntityType accept a nil receiver and return uuid.Nil in that case as well as not return the second bool from getIDForEntityType but just uuid.Nil. But it's a matter of taste, both are fine.

@JAORMX JAORMX marked this pull request as ready for review August 19, 2024 11:35
@JAORMX JAORMX merged commit 7895833 into main Aug 19, 2024
21 checks passed
@JAORMX JAORMX deleted the eea-entity-instance-in branch August 19, 2024 11:41
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.

Add reference to central entities table to EEA
4 participants