Skip to content

Commit

Permalink
tested even more different way of executing the source shema
Browse files Browse the repository at this point in the history
  • Loading branch information
CommanderStorm committed Oct 22, 2023
1 parent a7258bb commit 35e9224
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion server/backend/migration/20200000000000.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package migration

import (
_ "embed"
"strings"

"github.com/go-gormigrate/gormigrate/v2"
"gorm.io/gorm"
Expand All @@ -16,7 +17,12 @@ func (m TumDBMigrator) migrate20200000000000() *gormigrate.Migration {
return &gormigrate.Migration{
ID: "20200000000000",
Migrate: func(tx *gorm.DB) error {
return tx.Raw(sourceSchema).Error
for _, line := range strings.Split(sourceSchema, ";") {
if err := tx.Exec(line).Error; err != nil {
return err
}
}
return nil
},
Rollback: func(tx *gorm.DB) error {
tables := []string{"actions", "alarm_ban", "alarm_log", "barrierFree_moreInfo", "barrierFree_persons", "card_type", "chat_room", "crontab", "curricula", "dish", "dishflags", "dish2dishflags", "faculty", "feedback", "files", "kino", "lecture", "location", "member", "card", "card_box", "card_comment", "card_option", "chat_message", "chat_room2members", "devices", "device2stats", "members_card", "members_card_answer_history", "mensa", "dish2mensa", "mensaplan_mensa", "mensaprices", "migrations", "newsSource", "news", "news_alert", "notification_type", "notification", "notification_confirmation", "openinghours", "question", "question2answer", "question2faculty", "questionAnswers", "reports", "rights", "menu", "modules", "roles", "roles2rights", "roomfinder_building2area", "roomfinder_buildings", "roomfinder_buildings2gps", "roomfinder_buildings2maps", "roomfinder_maps", "roomfinder_rooms", "roomfinder_rooms2maps", "roomfinder_schedules", "sessions", "tag", "card2tag", "ticket_admin", "ticket_group", "event", "ticket_admin2group", "ticket_payment", "ticket_type", "ticket_history", "update_note", "users", "log", "recover", "users2info", "users2roles", "wifi_measurement"}
Expand Down

0 comments on commit 35e9224

Please sign in to comment.