-
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.
added a migration to remove the chat variabnt from the cronjob
- Loading branch information
1 parent
e13b8a9
commit 8689fd8
Showing
2 changed files
with
26 additions
and
1 deletion.
There are no files selected for viewing
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,25 @@ | ||
package migration | ||
|
||
import ( | ||
"github.com/TUM-Dev/Campus-Backend/server/model" | ||
"github.com/go-gormigrate/gormigrate/v2" | ||
"gorm.io/gorm" | ||
) | ||
|
||
// migrate20230825000000 | ||
// Removes the ability to run chat cronjobs | ||
func (m TumDBMigrator) migrate20230825000000() *gormigrate.Migration { | ||
return &gormigrate.Migration{ | ||
ID: "20230825000000", | ||
Migrate: func(tx *gorm.DB) error { | ||
// deactivete the crontab (Rollback deletes this from the enum) | ||
// given that previously, not cronjobs for this type existed there is no need to remove offending entries first | ||
return SafeEnumRollback(tx, &model.Crontab{}, "type", "chat") | ||
}, | ||
Rollback: func(tx *gorm.DB) error { | ||
// activete the crontab (Migrate adds this from to the enum) | ||
// given that previously, not cronjobs for this type existed there is no need to add entries first | ||
return SafeEnumMigrate(tx, &model.Crontab{}, "type", "chat") | ||
}, | ||
} | ||
} |
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