Skip to content

Commit 97e70ef

Browse files
authored
fix: use default foreign key (#1377)
1 parent 84dcb7c commit 97e70ef

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

pkg/infra/persistence/project_model.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ type ProjectModel struct {
1111
gorm.Model
1212
Name string `gorm:"index:unique_project,unique"`
1313
SourceID uint
14-
Source *SourceModel `gorm:"foreignKey:ID;references:SourceID"`
14+
Source *SourceModel
1515
OrganizationID uint
16-
Organization *OrganizationModel `gorm:"foreignKey:ID;references:OrganizationID"`
16+
Organization *OrganizationModel
1717
Path string
1818
Description string
1919
Labels MultiString

pkg/infra/persistence/resource_model.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212
type ResourceModel struct {
1313
gorm.Model
1414
StackID uint
15-
Stack *StackModel `gorm:"foreignKey:ID;references:StackID"`
15+
Stack *StackModel
1616
ResourceType string
1717
ResourcePlane string
1818
ResourceName string

pkg/infra/persistence/run_model.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ type RunModel struct {
1515
// StackID is the stack ID of the run.
1616
StackID uint
1717
// Stack is the stack of the run.
18-
Stack *StackModel `gorm:"foreignKey:ID;references:StackID"`
18+
Stack *StackModel
1919
// Workspace is the target workspace of the run.
2020
Workspace string
2121
// Status is the status of the run.

pkg/infra/persistence/workspace_model.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ type WorkspaceModel struct {
1414
Labels MultiString
1515
Owners MultiString
1616
BackendID uint
17-
Backend *BackendModel `gorm:"foreignKey:ID;references:BackendID"`
17+
Backend *BackendModel
1818
}
1919

2020
// The TableName method returns the name of the database table that the struct is mapped to.

0 commit comments

Comments
 (0)