Skip to content

Commit 2a3db7f

Browse files
authored
Fixed foreign key constraint (#127)
* Fixed foreign key constraint introduced in #117
1 parent 01c04ec commit 2a3db7f

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ This project tries to follow [SemVer 2.0.0](https://semver.org/).
218218

219219
- Added endpoints to allow setting manual overrides for a project. These
220220
overrides are used in responses from `GET /project` and other, as well as in
221-
build parameters for newly started builds. New endpoints: (#117)
221+
build parameters for newly started builds. New endpoints: (#117, #127)
222222

223223
- `GET /project/{projectId}/override` to get all overrides
224224
- `PUT /project/{projectId}/override` to set all overrides

pkg/model/database/database.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,13 +193,13 @@ type Project struct {
193193
Branches []Branch `gorm:"foreignKey:ProjectID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
194194
GitURL string `gorm:"not null;default:''"`
195195

196-
Overrides ProjectOverrides `gorm:"foreignKey:ProjectID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
196+
Overrides ProjectOverrides `gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
197197
}
198198

199199
// ProjectOverrides holds data about a project's overridden values.
200200
type ProjectOverrides struct {
201201
ProjectOverridesID uint `gorm:"primaryKey"`
202-
ProjectID uint `gorm:"uniqueIndex:project_overrides_idx_project_id"`
202+
ProjectID uint `gorm:"foreignKey:ProjectID;uniqueIndex:project_overrides_idx_project_id"`
203203
Description string `gorm:"size:500;not null;default:''"`
204204
AvatarURL string `gorm:"size:500;not null;default:''"`
205205
GitURL string `gorm:"not null;default:''"`

0 commit comments

Comments
 (0)