Skip to content

Commit

Permalink
different test
Browse files Browse the repository at this point in the history
  • Loading branch information
CommanderStorm committed Mar 13, 2024
1 parent acf5570 commit 95a4f80
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions server/backend/migration/20240311000000.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ func migrate20240311000000() *gormigrate.Migration {
ID: "20240311000000",
Migrate: func(tx *gorm.DB) error {
// make sure that dish_rating is FK-bound to dish
if err := tx.Exec("alter table dish_rating modify dishID int").Error; err != nil {
if err := tx.Exec("alter table dish modify dish int not null primary key auto_increment").Error; err != nil {
return err
}
if err := tx.Exec("alter table dish_rating add constraint dish_rating_dish_dish_fk foreign key (dishID) references dish (dish) on update cascade on delete cascade").Error; err != nil {
Expand All @@ -31,7 +31,7 @@ func migrate20240311000000() *gormigrate.Migration {
if err := tx.Exec("alter table dish_rating drop constraint dish_rating_dish_dish_fk").Error; err != nil {
return err
}
if err := tx.Exec("alter table dish_rating modify dishID int not null").Error; err != nil {
if err := tx.Exec("alter table dish_rating modify dish int primary key auto_increment").Error; err != nil {
return err
}
// because dishes already have a cafeteria, storing this agiain is not nessesary
Expand Down

0 comments on commit 95a4f80

Please sign in to comment.