39 lines
1.2 KiB
Go
39 lines
1.2 KiB
Go
package swmigration
|
|
|
|
import (
|
|
"gorm.io/gorm"
|
|
"kra/pkg/database/migration"
|
|
"time"
|
|
)
|
|
|
|
const TableName = "sys_business_upgrade_state"
|
|
const workflowName = "legacy-sw"
|
|
const workflowVersion = "20261106_automatic_v1"
|
|
|
|
type statePO struct {
|
|
Name string `gorm:"primaryKey;size:64"`
|
|
Version string `gorm:"size:64;not null"`
|
|
Phase string `gorm:"size:32;not null"`
|
|
DatabaseIdentity string `gorm:"size:128;not null"`
|
|
SourceWasLegacy bool
|
|
TasksRestored bool
|
|
BackupPath string `gorm:"type:text"`
|
|
BackupSHA256 string `gorm:"size:64"`
|
|
CleanupBackupPath string `gorm:"type:text"`
|
|
CleanupSHA256 string `gorm:"size:64"`
|
|
VerifiedMigrations string `gorm:"size:64"`
|
|
StartedAt time.Time
|
|
UpdatedAt time.Time
|
|
VerifiedAt *time.Time
|
|
CompletedAt *time.Time
|
|
LastError string `gorm:"type:text"`
|
|
}
|
|
|
|
func (statePO) TableName() string { return TableName }
|
|
|
|
func StateMigration() migration.Step {
|
|
return migration.Step{ID: "202611060025_automatic_upgrade_state", Migrate: func(db *gorm.DB) error { return migration.CreateMissingTables(db, &statePO{}) }}
|
|
}
|
|
|
|
func CheckSchema(db *gorm.DB) error { return migration.CheckModels(db, &statePO{}) }
|