Skip to content

Commit

Permalink
fixed the cascading of question2answer not being defined
Browse files Browse the repository at this point in the history
  • Loading branch information
CommanderStorm committed Jan 2, 2024
1 parent 3b4cac0 commit f3e170a
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions server/backend/migration/20240103000000.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f3e170a

Please sign in to comment.