feat: reworking on security advisory feature - #2600
Conversation
|
|
||
| type Advisory struct { | ||
| ID int64 `json:"id" gorm:"primaryKey;column:id"` | ||
| Vulnerability `gorm:"-"` |
There was a problem hiding this comment.
What is the reason behind this? There should be some properties we can actually reuse. Is the struct so different?
There was a problem hiding this comment.
AI made this change because i had errors with the embedding of the vulnerability. The justification was: The embedded Vulnerability struct is included for method promotion (Go embedding), so Advisory satisfies the shared vuln interface via methods like GetTicketID(), SetTicketID(), etc. — not for persistence. The gorm:"-" tag tells GORM to ignore this field entirely (no column mapping, no reads/writes, no migration). Without it, GORM would promote the embedded struct's fields (ID, AssetID, CreatedAt, UpdatedAt) into the advisories table, conflicting with Advisory's own identically-named columns and breaking auto-migration.
No description provided.