-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
migrated the src schema to live in an migation
- Loading branch information
1 parent
ba3d9c7
commit 5aa08e0
Showing
4 changed files
with
30 additions
and
9 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package migration | ||
|
||
import ( | ||
_ "embed" | ||
"github.com/go-gormigrate/gormigrate/v2" | ||
"gorm.io/gorm" | ||
) | ||
|
||
//go:embed static_data/source-schema.sql | ||
var sourceSchema string | ||
|
||
// migrate20200000000000 | ||
// adds the source shema | ||
func (m TumDBMigrator) migrate20200000000000() *gormigrate.Migration { | ||
return &gormigrate.Migration{ | ||
ID: "20200000000000", | ||
Migrate: func(tx *gorm.DB) error { | ||
return tx.Exec(sourceSchema).Error | ||
}, | ||
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"} | ||
for _, table := range tables { | ||
if err := tx.Migrator().DropTable(table); err != nil { | ||
return err | ||
} | ||
} | ||
return nil | ||
}, | ||
} | ||
} |
File renamed without changes.