mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-09 00:56: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),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@ type PagesDeployment struct {
|
||||
ArtifactPath string `json:"artifact_path" gorm:"size:2048;not null"`
|
||||
FileCount int `json:"file_count" gorm:"not null;default:0"`
|
||||
TotalSize int64 `json:"total_size" gorm:"not null;default:0"`
|
||||
RootDir string `json:"root_dir" gorm:"size:512;not null;default:''"`
|
||||
EntryFile string `json:"entry_file" gorm:"size:512;not null;default:'index.html'"`
|
||||
CreatedBy string `json:"created_by" gorm:"size:64;not null;default:''"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
|
||||
Reference in New Issue
Block a user