Skip to content

Commit 944be3f

Browse files
authored
fix: allow leaving account if invitation sent (#1005)
Signed-off-by: Miguel Martinez Trivino <[email protected]>
1 parent 7962d6c commit 944be3f

File tree

4 files changed

+6
-3
lines changed

4 files changed

+6
-3
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
-- Modify "org_invitations" table
2+
ALTER TABLE "org_invitations" DROP CONSTRAINT "org_invitations_users_sender", ADD CONSTRAINT "org_invitations_users_sender" FOREIGN KEY ("sender_id") REFERENCES "users" ("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:82cUwRJAj5kE2XfpFYdbdwE/i7/XKnfPfr8IgG1aslk=
1+
h1:2bUE9JYemsFf4AISpMSlMxMh6JgV7y7NQOyjg2WMcUM=
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=
@@ -34,3 +34,4 @@ h1:82cUwRJAj5kE2XfpFYdbdwE/i7/XKnfPfr8IgG1aslk=
3434
20240410132210.sql h1:Ed1XXWkREYgOeTAAkVv+j3IV215TxgdXq+U5zIZOWuk=
3535
20240509153904.sql h1:qjQLIMmKH3CqJ01uMbvfvB8aHct3JBkx5GPoWcqUStU=
3636
20240619193218.sql h1:hJG4mhjqKQ2E0YEURM1x06MsFWJXUcKSqwNDJXUhGvc=
37+
20240620214339.sql h1:32nxfoUXtESJp8Du8r9tczQYNKNccUUm3Qp6tu/ixXE=

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ var (
255255
Symbol: "org_invitations_users_sender",
256256
Columns: []*schema.Column{OrgInvitationsColumns[7]},
257257
RefColumns: []*schema.Column{UsersColumns[0]},
258-
OnDelete: schema.NoAction,
258+
OnDelete: schema.Cascade,
259259
},
260260
},
261261
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,6 @@ func (OrgInvitation) Fields() []ent.Field {
5555
func (OrgInvitation) Edges() []ent.Edge {
5656
return []ent.Edge{
5757
edge.To("organization", Organization.Type).Unique().Required().Field("organization_id").Annotations(entsql.Annotation{OnDelete: entsql.Cascade}),
58-
edge.To("sender", User.Type).Unique().Required().Field("sender_id"),
58+
edge.To("sender", User.Type).Unique().Required().Field("sender_id").Annotations(entsql.Annotation{OnDelete: entsql.Cascade}),
5959
}
6060
}

0 commit comments

Comments
 (0)