Skip to content

Commit 7e4da57

Browse files
committed
fix org deletion
Signed-off-by: Miguel Martinez <miguel@chainloop.dev>
1 parent 80b52e4 commit 7e4da57

5 files changed

Lines changed: 8 additions & 4 deletions

File tree

CLAUDE.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,4 +256,5 @@ Code reviews are required for all submissions via GitHub pull requests.
256256

257257

258258
- I do not want you to be in the co-author signoff
259-
- make sure all go code is go-fmt
259+
- make sure all go code is go-fmt
260+
- when the schema is changed, run make generate, do not create a migration explicitly
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
-- Modify "attestations" table
2+
ALTER TABLE "attestations" DROP CONSTRAINT "attestations_workflow_runs_attestation_bundle", ADD CONSTRAINT "attestations_workflow_runs_attestation_bundle" FOREIGN KEY ("workflowrun_id") REFERENCES "workflow_runs" ("id") ON UPDATE NO ACTION ON DELETE CASCADE;

app/controlplane/pkg/data/ent/migrate/migrations/atlas.sum

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
h1:CR4ZZX0wKUI9H+dldKzHZ2IkDpnRSTyssXoCkVJk31g=
1+
h1:QaClWT8b1Nr8BRNI+5O2WAYbWl/5tTlopLggA6RQwzw=
22
20230706165452_init-schema.sql h1:VvqbNFEQnCvUVyj2iDYVQQxDM0+sSXqocpt/5H64k8M=
33
20230710111950-cas-backend.sql h1:A8iBuSzZIEbdsv9ipBtscZQuaBp3V5/VMw7eZH6GX+g=
44
20230712094107-cas-backends-workflow-runs.sql h1:a5rzxpVGyd56nLRSsKrmCFc9sebg65RWzLghKHh5xvI=
@@ -107,3 +107,4 @@ h1:CR4ZZX0wKUI9H+dldKzHZ2IkDpnRSTyssXoCkVJk31g=
107107
20250808164000.sql h1:T6Yt5JhbfB+7iY4WPpeCEsT3G5wplxTBB64De3ZXNus=
108108
20250808164400.sql h1:r7S2LM8d3kbKQ7WNuggjvmNw3kcccx0rYzzklw8Q2I8=
109109
20250808165202.sql h1:Oreh9FpYwo/cdcs3Oza/+ACzScXeTRBGIEvua8RqoLo=
110+
20250812111458.sql h1:15yQlZoBymYR5GEjGLtV/j4ZZjg06u6eEzcRRl7vax4=

app/controlplane/pkg/data/ent/migrate/schema.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ var (
7676
Symbol: "attestations_workflow_runs_attestation_bundle",
7777
Columns: []*schema.Column{AttestationsColumns[3]},
7878
RefColumns: []*schema.Column{WorkflowRunsColumns[0]},
79-
OnDelete: schema.NoAction,
79+
OnDelete: schema.Cascade,
8080
},
8181
},
8282
}

app/controlplane/pkg/data/ent/schema/workflowrun.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ func (WorkflowRun) Edges() []ent.Edge {
7373
edge.To("cas_backends", CASBackend.Type),
7474
// not required since we have old data
7575
edge.From("version", ProjectVersion.Type).Field("version_id").Ref("runs").Unique().Required(),
76-
edge.To("attestation_bundle", Attestation.Type).Unique(),
76+
edge.To("attestation_bundle", Attestation.Type).Unique().Annotations(entsql.Annotation{OnDelete: entsql.Cascade}),
7777
}
7878
}
7979

0 commit comments

Comments
 (0)