mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-12 02:06:37 +08:00
[优化] 增加根目录选项
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
package goose
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
presslygoose "github.com/pressly/goose/v3"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
const versionPagesDeploymentRootDir int64 = 202606040001
|
||||
|
||||
// migration202606040001 adds RootDir field to Pages deployments.
|
||||
func migration202606040001(backend string, ctx Context) *presslygoose.Migration {
|
||||
return newGORMMigration(
|
||||
versionPagesDeploymentRootDir,
|
||||
"202606040001_add_pages_deployment_root_dir.go",
|
||||
backend,
|
||||
ctx,
|
||||
migratePagesDeploymentRootDir,
|
||||
)
|
||||
}
|
||||
|
||||
func migratePagesDeploymentRootDir(ctx Context, db *gorm.DB, backend string) error {
|
||||
if err := ctx.ApplyCurrentSchema(db, backend); err != nil {
|
||||
return err
|
||||
}
|
||||
// Verify that the column exists
|
||||
if !db.Migrator().HasColumn("pages_deployments", "root_dir") {
|
||||
return fmt.Errorf("column pages_deployments.root_dir is missing")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -45,6 +45,7 @@ func registeredMigrations(backend string, ctx Context) []*presslygoose.Migration
|
||||
migration202606030002(backend, ctx),
|
||||
migration202606030003(backend, ctx),
|
||||
migration202606030004(backend, ctx),
|
||||
migration202606040001(backend, ctx),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user