refactor: Remove recovery migration files for transfer_configs, notification_services, and auth_providers

- Deleted migration files that handled recovery for inconsistent states in transfer_configs, notification_services, and auth_providers tables.
- Updated migration management to reflect the removal of these recovery steps, ensuring cleaner migration logic.
This commit is contained in:
StarFleetCPTN
2025-04-08 21:00:41 -07:00
parent bcd09af2d6
commit 78fe589fcf
4 changed files with 12 additions and 12 deletions
@@ -12,9 +12,9 @@ import (
// table might have been left renamed as _transfer_configs_old.
func RecoverTransferConfigsRename() *gormigrate.Migration {
return &gormigrate.Migration{
ID: "011a_recover_transfer_configs_rename",
ID: "012a_recover_transfer_configs_rename",
Migrate: func(tx *gorm.DB) error {
fmt.Println("Running migration 011a: Checking for transfer_configs rename recovery...")
fmt.Println("Running migration 012a: Checking for transfer_configs rename recovery...")
var oldTableExists int
tx.Raw("SELECT count(*) FROM sqlite_master WHERE type='table' AND name='_transfer_configs_old'").Scan(&oldTableExists)
@@ -40,7 +40,7 @@ func RecoverTransferConfigsRename() *gormigrate.Migration {
},
Rollback: func(tx *gorm.DB) error {
// Rollback doesn't make sense for a recovery step.
fmt.Println("Rollback for migration 011a_recover_transfer_configs_rename is not applicable.")
fmt.Println("Rollback for migration 012a_recover_transfer_configs_rename is not applicable.")
return nil
},
}
@@ -12,9 +12,9 @@ import (
// table might have been left renamed as _notification_services_old.
func RecoverNotificationServicesRename() *gormigrate.Migration {
return &gormigrate.Migration{
ID: "011b_recover_notification_services_rename",
ID: "012b_recover_notification_services_rename",
Migrate: func(tx *gorm.DB) error {
fmt.Println("Running migration 011b: Checking for notification_services rename recovery...")
fmt.Println("Running migration 012b: Checking for notification_services rename recovery...")
var oldTableExists int
tx.Raw("SELECT count(*) FROM sqlite_master WHERE type='table' AND name='_notification_services_old'").Scan(&oldTableExists)
@@ -38,7 +38,7 @@ func RecoverNotificationServicesRename() *gormigrate.Migration {
},
Rollback: func(tx *gorm.DB) error {
// Rollback doesn't make sense for a recovery step.
fmt.Println("Rollback for migration 011b_recover_notification_services_rename is not applicable.")
fmt.Println("Rollback for migration 012b_recover_notification_services_rename is not applicable.")
return nil
},
}
@@ -12,9 +12,9 @@ import (
// table might have been left renamed as _auth_providers_old.
func RecoverAuthProvidersRename() *gormigrate.Migration {
return &gormigrate.Migration{
ID: "011c_recover_auth_providers_rename",
ID: "012c_recover_auth_providers_rename",
Migrate: func(tx *gorm.DB) error {
fmt.Println("Running migration 011c: Checking for auth_providers rename recovery...")
fmt.Println("Running migration 012c: Checking for auth_providers rename recovery...")
var oldTableExists int
tx.Raw("SELECT count(*) FROM sqlite_master WHERE type='table' AND name='_auth_providers_old'").Scan(&oldTableExists)
@@ -38,7 +38,7 @@ func RecoverAuthProvidersRename() *gormigrate.Migration {
},
Rollback: func(tx *gorm.DB) error {
// Rollback doesn't make sense for a recovery step.
fmt.Println("Rollback for migration 011c_recover_auth_providers_rename is not applicable.")
fmt.Println("Rollback for migration 012c_recover_auth_providers_rename is not applicable.")
return nil
},
}
+3 -3
View File
@@ -22,10 +22,10 @@ func GetMigrations(db *gorm.DB) *gormigrate.Gormigrate {
AddRcloneTables(), // 009
AddRcloneCommandToConfig(), // 010
AddAuthProviders(), // 011
RecoverTransferConfigsRename(), // 011a
RecoverNotificationServicesRename(), // 011b
RecoverAuthProvidersRename(), // 011c
AlterBooleanDefaults(), // 012
RecoverTransferConfigsRename(), // 012a
RecoverNotificationServicesRename(), // 012b
RecoverAuthProvidersRename(), // 012c
CleanupInvalidBooleans(), // 013
)