From f3e170ab3ceb6992e5a87c059c1aceb83d9afe81 Mon Sep 17 00:00:00 2001 From: Frank Elsinga Date: Wed, 3 Jan 2024 00:55:14 +0100 Subject: [PATCH] fixed the cascading of `question2answer` not being defined --- server/backend/migration/20240103000000.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/server/backend/migration/20240103000000.go b/server/backend/migration/20240103000000.go index c6a2f2c9..7f305e1a 100644 --- a/server/backend/migration/20240103000000.go +++ b/server/backend/migration/20240103000000.go @@ -13,17 +13,20 @@ func migrate20240103000000() *gormigrate.Migration { Migrate: func(tx *gorm.DB) error { if err := tx.Exec(`alter table question2answer add constraint question2answer_member_member_fk - foreign key (member) references member (member);`).Error; err != nil { + foreign key (member) references member (member) + on update cascade on delete cascade;`).Error; err != nil { return err } if err := tx.Exec(`alter table question2answer add constraint question2answer_questionAnswers_answer_fk - foreign key (answer) references questionAnswers (answer);`).Error; err != nil { + foreign key (answer) references questionAnswers (answer) + on update cascade on delete cascade;`).Error; err != nil { return err } if err := tx.Exec(`alter table question2answer add constraint question2answer_question_question_fk - foreign key (question) references question (question);`).Error; err != nil { + foreign key (question) references question (question) + on update cascade on delete cascade;`).Error; err != nil { return err } return nil