Fixed linting issues
Some checks failed
CI / Test (1.24) (push) Successful in -25m42s
CI / Test (1.25) (push) Successful in -25m40s
CI / Build (push) Successful in -25m54s
CI / Lint (push) Successful in -25m27s
Integration Tests / Integration Tests (push) Failing after -25m48s

This commit is contained in:
2025-12-28 14:51:19 +02:00
parent 2a271b9859
commit b55737ab4c
2 changed files with 9 additions and 13 deletions

View File

@@ -438,21 +438,22 @@ func (r *Reader) parseRelationshipConstraints(table *models.Table, structType *a
var fkTable *models.Table
var fkColumn, refTable, refColumn string
if relType == "belongs-to" {
switch strings.ToLower(relType) {
case "belongs-to":
// For belongs-to: FK is on the current table
// join:user_id=id means table.user_id references referencedTable.id
fkTable = table
fkColumn = joinInfo.ForeignKey
refTable = referencedTable.Name
refColumn = joinInfo.ReferencedKey
} else if relType == "has-many" {
case "has-many":
// For has-many: FK is on the referenced table
// join:id=user_id means referencedTable.user_id references table.id
fkTable = referencedTable
fkColumn = joinInfo.ReferencedKey
refTable = table.Name
refColumn = joinInfo.ForeignKey
} else {
default:
continue
}