mirror of
https://github.com/StarFleetCPTN/GoMFT.git
synced 2026-09-20 13:30:51 +02:00
- Introduced a new migration (013_cleanup_invalid_booleans) to update boolean columns represented as integers in the transfer_configs, notification_services, and auth_providers tables. - Ensured that only valid values (0, 1, or NULL) are retained, setting any invalid values to 0. - Added error handling for potential issues during the migration process, including checks for table existence before attempting updates. This migration improves data integrity by standardizing boolean representations across the database. https://github.com/StarFleetCPTN/GoMFT/issues/69
31 lines
884 B
Go
31 lines
884 B
Go
package migrations
|
|
|
|
import (
|
|
"github.com/go-gormigrate/gormigrate/v2"
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
var migrations []*gormigrate.Migration
|
|
|
|
// GetMigrations returns all migrations
|
|
func GetMigrations(db *gorm.DB) *gormigrate.Gormigrate {
|
|
// Add all migrations in order
|
|
migrations = append(migrations,
|
|
InitialSchema(), // 001
|
|
UpdateGDriveType(), // 002
|
|
Add2FA(), // 003
|
|
AddAuditLogs(), // 004
|
|
AddDefaultRoles(), // 005
|
|
AddTimestampsToJobHistories(), // 006
|
|
AddNotificationServices(), // 007
|
|
AddUserNotifications(), // 008
|
|
AddRcloneTables(), // 009
|
|
AddRcloneCommandToConfig(), // 010
|
|
AddAuthProviders(), // 011
|
|
AlterBooleanDefaults(), // 012
|
|
CleanupInvalidBooleans(), // 013
|
|
)
|
|
|
|
return gormigrate.New(db, gormigrate.DefaultOptions, migrations)
|
|
}
|