// Command pocketbase is a thin wrapper that runs PocketBase as a Go framework // with version-controlled Go migrations. // // On every `serve`, PocketBase automatically applies any pending migrations from // the migrations/ package before accepting traffic. // // Usage (Docker): // // ./pocketbase serve --dir /pb_data --http 0.0.0.0:8090 // // Migration workflow: // // # Generate a timestamped stub: // go run ./cmd/pocketbase migrate create "description" // # Apply manually (also runs automatically on serve): // go run ./cmd/pocketbase migrate up // # Revert last migration: // go run ./cmd/pocketbase migrate down 1 // # After migrating an existing install, mark existing schema as done: // go run ./cmd/pocketbase migrate history-sync package main import ( "log" "github.com/pocketbase/pocketbase" "github.com/pocketbase/pocketbase/plugins/migratecmd" // Register all migrations via init(). _ "github.com/libnovel/backend/migrations" ) func main() { app := pocketbase.New() // Register the migrate sub-command. // Automigrate: false — migrations are written by hand, never auto-generated // from Admin UI changes. Pending migrations still apply automatically on // every `serve` regardless of this flag. migratecmd.MustRegister(app, app.RootCmd, migratecmd.Config{ Automigrate: false, }) if err := app.Start(); err != nil { log.Fatal(err) } }