File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ -- Copyright (C) 2026 l3montree GmbH
2+ --
3+ -- This program is free software: you can redistribute it and/or modify
4+ -- it under the terms of the GNU Affero General Public License as
5+ -- published by the Free Software Foundation, either version 3 of the
6+ -- License, or (at your option) any later version.
7+ --
8+ -- This program is distributed in the hope that it will be useful,
9+ -- but WITHOUT ANY WARRANTY; without even the implied warranty of
10+ -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+ -- GNU Affero General Public License for more details.
12+ --
13+ -- You should have received a copy of the GNU Affero General Public License
14+ -- along with this program. If not, see <https://www.gnu.org/licenses/>.
15+
16+ ALTER TABLE public .external_user_orgs
17+ DROP CONSTRAINT IF EXISTS fk_external_user_orgs_org;
18+
19+ ALTER TABLE public .external_user_orgs
20+ ADD CONSTRAINT fk_external_user_orgs_org
21+ FOREIGN KEY (org_id) REFERENCES public .organizations (id) ON DELETE CASCADE ;
22+
23+ ALTER TABLE public .external_user_orgs
24+ DROP CONSTRAINT IF EXISTS fk_external_user_orgs_external_user;
25+
26+ ALTER TABLE public .external_user_orgs
27+ ADD CONSTRAINT fk_external_user_orgs_external_user
28+ FOREIGN KEY (external_user_id) REFERENCES public .external_users (id) ON DELETE CASCADE ;
Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ type ExternalUser struct {
4444 ID string `json:"id" gorm:"primaryKey"`
4545 Username string `json:"username"`
4646 AvatarURL string `json:"avatarUrl"`
47- Organizations []Org `json:"orgs" gorm:"many2many:external_user_orgs;"`
47+ Organizations []Org `json:"orgs" gorm:"many2many:external_user_orgs;constraint:OnDelete:CASCADE; "`
4848}
4949
5050func (ExternalUser ) TableName () string {
You can’t perform that action at this time.
0 commit comments