Skip to content

fix: use default foreign key #1377

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

Merged
merged 1 commit into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pkg/infra/persistence/project_model.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ type ProjectModel struct {
gorm.Model
Name string `gorm:"index:unique_project,unique"`
SourceID uint
Source *SourceModel `gorm:"foreignKey:ID;references:SourceID"`
Source *SourceModel
OrganizationID uint
Organization *OrganizationModel `gorm:"foreignKey:ID;references:OrganizationID"`
Organization *OrganizationModel
Path string
Description string
Labels MultiString
Expand Down
2 changes: 1 addition & 1 deletion pkg/infra/persistence/resource_model.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
type ResourceModel struct {
gorm.Model
StackID uint
Stack *StackModel `gorm:"foreignKey:ID;references:StackID"`
Stack *StackModel
ResourceType string
ResourcePlane string
ResourceName string
Expand Down
2 changes: 1 addition & 1 deletion pkg/infra/persistence/run_model.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type RunModel struct {
// StackID is the stack ID of the run.
StackID uint
// Stack is the stack of the run.
Stack *StackModel `gorm:"foreignKey:ID;references:StackID"`
Stack *StackModel
// Workspace is the target workspace of the run.
Workspace string
// Status is the status of the run.
Expand Down
2 changes: 1 addition & 1 deletion pkg/infra/persistence/workspace_model.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type WorkspaceModel struct {
Labels MultiString
Owners MultiString
BackendID uint
Backend *BackendModel `gorm:"foreignKey:ID;references:BackendID"`
Backend *BackendModel
}

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