@@ -74,7 +74,7 @@ type Pool struct {
7474 GitHubRunnerGroup string
7575
7676 RepoID * uuid.UUID `gorm:"index"`
77- Repository Repository `gorm:"foreignKey:RepoID"`
77+ Repository Repository `gorm:"foreignKey:RepoID; "`
7878
7979 OrgID * uuid.UUID `gorm:"index"`
8080 Organization Organization `gorm:"foreignKey:OrgID"`
@@ -92,7 +92,8 @@ type Repository struct {
9292 Owner string `gorm:"index:idx_owner_nocase,unique,collate:nocase"`
9393 Name string `gorm:"index:idx_owner_nocase,unique,collate:nocase"`
9494 WebhookSecret []byte
95- Pools []Pool `gorm:"foreignKey:RepoID"`
95+ Pools []Pool `gorm:"foreignKey:RepoID"`
96+ Jobs []WorkflowJob `gorm:"foreignKey:RepoID;constraint:OnDelete:SET NULL"`
9697}
9798
9899type Organization struct {
@@ -101,7 +102,8 @@ type Organization struct {
101102 CredentialsName string
102103 Name string `gorm:"index:idx_org_name_nocase,collate:nocase"`
103104 WebhookSecret []byte
104- Pools []Pool `gorm:"foreignKey:OrgID"`
105+ Pools []Pool `gorm:"foreignKey:OrgID"`
106+ Jobs []WorkflowJob `gorm:"foreignKey:OrgID;constraint:OnDelete:SET NULL"`
105107}
106108
107109type Enterprise struct {
@@ -110,7 +112,8 @@ type Enterprise struct {
110112 CredentialsName string
111113 Name string `gorm:"index:idx_ent_name_nocase,collate:nocase"`
112114 WebhookSecret []byte
113- Pools []Pool `gorm:"foreignKey:EnterpriseID"`
115+ Pools []Pool `gorm:"foreignKey:EnterpriseID"`
116+ Jobs []WorkflowJob `gorm:"foreignKey:EnterpriseID;constraint:OnDelete:SET NULL"`
114117}
115118
116119type Address struct {
0 commit comments