Skip to content

Commit

Permalink
make trigger key index unique (#4410)
Browse files Browse the repository at this point in the history
Signed-off-by: Yee Hing Tong <[email protected]>
  • Loading branch information
wild-endeavor authored Nov 13, 2023
1 parent ee03489 commit 9741afc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions flyteartifacts/pkg/db/gorm_models.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ type Artifact struct {

type TriggerKey struct {
gorm.Model
Project string `gorm:"index:idx_pdn;index:idx_proj;type:varchar(64)"`
Domain string `gorm:"index:idx_pdn;index:idx_dom;type:varchar(64)"`
Name string `gorm:"index:idx_pdn;index:idx_name;type:varchar(255)"`
Project string `gorm:"uniqueIndex:idx_t_pdn;index:idx_t_proj;type:varchar(64)"`
Domain string `gorm:"uniqueIndex:idx_t_pdn;index:idx_t_dom;type:varchar(64)"`
Name string `gorm:"uniqueIndex:idx_t_pdn;index:idx_t_name;type:varchar(255)"`
RunsOn []ArtifactKey `gorm:"many2many:active_trigger_artifact_keys;"`
}

Expand Down
6 changes: 3 additions & 3 deletions flyteartifacts/pkg/db/migrations.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ var Migrations = []*gormigrate.Migration{
Migrate: func(tx *gorm.DB) error {
type TriggerKey struct {
gorm.Model
Project string `gorm:"index:idx_t_pdn;index:idx_t_proj;type:varchar(64)"`
Domain string `gorm:"index:idx_t_pdn;index:idx_t_dom;type:varchar(64)"`
Name string `gorm:"index:idx_t_pdn;index:idx_t_name;type:varchar(255)"`
Project string `gorm:"uniqueIndex:idx_t_pdn;index:idx_t_proj;type:varchar(64)"`
Domain string `gorm:"uniqueIndex:idx_t_pdn;index:idx_t_dom;type:varchar(64)"`
Name string `gorm:"uniqueIndex:idx_t_pdn;index:idx_t_name;type:varchar(255)"`
RunsOn []ArtifactKey `gorm:"many2many:active_trigger_artifact_keys;"`
}

Expand Down

0 comments on commit 9741afc

Please sign in to comment.