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

feat: implement entity field in /{software/,}logs #177

Merged
merged 1 commit into from Nov 7, 2022
Merged

Conversation

bfabio
Copy link
Member

@bfabio bfabio commented Nov 3, 2022

No description provided.

@bfabio bfabio force-pushed the entity-logs branch 3 times, most recently from a5bd85a to a9fdd39 Compare November 3, 2022 15:18
@bfabio
Copy link
Member Author

bfabio commented Nov 3, 2022

The test failing looks like a gorm bug 🤔 Gotta investigate it.

@bfabio
Copy link
Member Author

bfabio commented Nov 4, 2022

Tests fail when using PostgreSQL as backend as well

@bfabio
Copy link
Member Author

bfabio commented Nov 4, 2022

Ok confirming as a gorm bug.

Looks like it's this one go-gorm/gorm#5417, fixed in recent releases

@bfabio
Copy link
Member Author

bfabio commented Nov 4, 2022

@LorenzoS92 fixed, ready for review

EntityType string `json:"-"`
EntityID *string `json:"-"`
EntityType *string `json:"-"`
Entity string `json:"entity,omitempty" gorm:"->;type:text GENERATED ALWAYS AS (CASE WHEN entity_id IS NULL THEN NULL ELSE ('/' || entity_type || '/' || entity_id) END) STORED;default:(-);"` //nolint:lll
Copy link
Contributor

Choose a reason for hiding this comment

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

Curioso quel simbolo dentro gorm, cosa serve?

Copy link
Member Author

@bfabio bfabio Nov 7, 2022

Choose a reason for hiding this comment

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

@LorenzoS92 it specifies permissions for that field, in that case we set it read only since it's a automatically generated field.

@bfabio bfabio merged commit 0563de9 into main Nov 7, 2022
@bfabio bfabio deleted the entity-logs branch November 7, 2022 13:12
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.

None yet

2 participants