[优化] 修复错误

This commit is contained in:
ryan
2026-06-04 10:21:07 +08:00
parent 29fdc378a1
commit 1c1063f448
3 changed files with 75 additions and 40 deletions
@@ -23,12 +23,12 @@ func migration202606040003(backend string, ctx Context) *presslygoose.Migration
func migratePagesDeploymentDropUnusedFields(ctx Context, db *gorm.DB, backend string) error {
// Drop columns root_dir and entry_file from pages_deployments
if db.Migrator().HasColumn("pages_deployments", "root_dir") {
if err := db.Migrator().DropColumn("pages_deployments", "root_dir"); err != nil {
if err := db.Exec("ALTER TABLE pages_deployments DROP COLUMN root_dir").Error; err != nil {
return fmt.Errorf("failed to drop pages_deployments.root_dir: %w", err)
}
}
if db.Migrator().HasColumn("pages_deployments", "entry_file") {
if err := db.Migrator().DropColumn("pages_deployments", "entry_file"); err != nil {
if err := db.Exec("ALTER TABLE pages_deployments DROP COLUMN entry_file").Error; err != nil {
return fmt.Errorf("failed to drop pages_deployments.entry_file: %w", err)
}
}