Documentation
¶
Index ¶
- Constants
- Variables
- func GeneratePrismaMigration(ctx context.Context, opts PrismaMigrationGenerateOptions) error
- func GeneratePrismaMigrationForRuntime(ctx context.Context, rt *project.Runtime, opts PrismaMigrationGenerateOptions) error
- func MigrationSnapshotKey(state *MigrationState) string
- func PrismaMigrateDeployCommand(schemaPath string) process.CommandSpec
- func PrismaMigrateDevCommand(schemaPath, name string, createOnly bool) process.CommandSpec
- func PrismaSnapshotKey(state *PrismaState) string
- func SnapshotKey(parts ...string) string
- type CommandSourcePolicy
- type Config
- type ManagedMigrationOptions
- type ManagedMigrationResult
- type Manager
- func (m *Manager) Desired(instanceID string, cfg Config) api.DBInstance
- func (m *Manager) DestroyRuntime(ctx context.Context, db api.DBInstance, removeVolume bool) error
- func (m *Manager) EnsureMigratedDatabase(ctx context.Context, opts ManagedMigrationOptions) (*ManagedMigrationResult, error)
- func (m *Manager) EnsurePrismaDevDatabase(ctx context.Context, opts PrismaDevDatabaseOptions) (*PrismaDevDatabaseResult, error)
- func (m *Manager) EnsureRuntime(ctx context.Context, db api.DBInstance) error
- func (m *Manager) ExecSQL(ctx context.Context, db api.DBInstance, statement string) ([]byte, error)
- func (m *Manager) PrepareMigrationBase(ctx context.Context, db api.DBInstance, state *MigrationState, ...) (*MigrationBaseResult, error)
- func (m *Manager) PreparePrismaBase(ctx context.Context, db api.DBInstance, state *PrismaState, ...) (*PrismaBaseResult, error)
- func (m *Manager) PreparePrismaMigrationAuthoringDatabase(ctx context.Context, opts PrismaMigrationAuthoringOptions) (*PrismaMigrationAuthoringResult, error)
- func (m *Manager) RestoreNearestMigrationSnapshot(ctx context.Context, db api.DBInstance, state *MigrationState) (*MigrationRestoreResult, error)
- func (m *Manager) RestoreNearestPrismaSnapshot(ctx context.Context, db api.DBInstance, state *PrismaState) (*PrismaRestoreResult, error)
- func (m *Manager) RestoreSnapshot(ctx context.Context, db api.DBInstance, key string) (*SnapshotManifest, error)
- func (m *Manager) Snapshot(ctx context.Context, db api.DBInstance, key string) (*SnapshotManifest, error)
- func (m *Manager) SnapshotMigrations(ctx context.Context, db api.DBInstance, key string, state *MigrationState) (*MigrationRestoreResult, error)
- func (m *Manager) SnapshotPrisma(ctx context.Context, db api.DBInstance, key string, state *PrismaState) (*PrismaRestoreResult, error)
- func (m *Manager) StartRuntimeService(ctx context.Context, db api.DBInstance, opts RuntimeServiceOptions) (*RuntimeServiceHandle, error)
- func (m *Manager) StopRuntime(ctx context.Context, db api.DBInstance) error
- func (m *Manager) WaitHostReady(ctx context.Context, db api.DBInstance, timeout time.Duration) error
- func (m *Manager) WaitReady(ctx context.Context, db api.DBInstance, timeout time.Duration) error
- type MigrationApplyFunc
- type MigrationApplyOptions
- type MigrationBaseResult
- type MigrationNeededError
- type MigrationPoint
- type MigrationRestorePlan
- type MigrationRestoreResult
- type MigrationSnapshot
- type MigrationState
- type PayloadCMSComponent
- func (p *PayloadCMSComponent) AddPrompts(prompts ...process.PromptSpec) *PayloadCMSComponent
- func (p *PayloadCMSComponent) AddSchemaInputs(inputs ...any) *PayloadCMSComponent
- func (p *PayloadCMSComponent) Command(name string, args ...string) *PayloadCMSComponent
- func (p *PayloadCMSComponent) Config(path string) *PayloadCMSComponent
- func (p *PayloadCMSComponent) Database(db *PostgresComponent) *PayloadCMSComponent
- func (p *PayloadCMSComponent) ForceAcceptWarningsEnv(key string) *PayloadCMSComponent
- func (p *PayloadCMSComponent) MigrationDir(path string) *PayloadCMSComponent
- func (p *PayloadCMSComponent) MigrationNameEnv(key string) *PayloadCMSComponent
- func (p *PayloadCMSComponent) Migrations(b *project.Builder) *project.TaskBuilder
- func (p *PayloadCMSComponent) NewMigration(b *project.Builder) *project.TaskBuilder
- func (p *PayloadCMSComponent) Prompts(prompts ...process.PromptSpec) *PayloadCMSComponent
- func (p *PayloadCMSComponent) ReadyTimeout(timeout time.Duration) *PayloadCMSComponent
- func (p *PayloadCMSComponent) SchemaInputs(inputs ...any) *PayloadCMSComponent
- type PostgresComponent
- func (p *PostgresComponent) ContainerPort(port int) *PostgresComponent
- func (p *PostgresComponent) DatabaseName(name string) *PostgresComponent
- func (p *PostgresComponent) Image(image string) *PostgresComponent
- func (p *PostgresComponent) Password(password string) *PostgresComponent
- func (p *PostgresComponent) PortName(name string) *PostgresComponent
- func (p *PostgresComponent) SidecarImage(image string) *PostgresComponent
- func (p *PostgresComponent) SnapshotRoot(path string) *PostgresComponent
- func (p *PostgresComponent) User(user string) *PostgresComponent
- type PostgresDumpSourcePolicy
- type PrepareOptions
- type PrismaBaseResult
- type PrismaComponent
- func (p *PrismaComponent) BasePaths(paths ...string) *PrismaComponent
- func (p *PrismaComponent) Client(b *project.Builder) *project.TaskBuilder
- func (p *PrismaComponent) CloneFromEnv(key string) *PrismaComponent
- func (p *PrismaComponent) Database(db *PostgresComponent) *PrismaComponent
- func (p *PrismaComponent) MigrationDir(path string) *PrismaComponent
- func (p *PrismaComponent) Migrations(b *project.Builder) *project.TaskBuilder
- func (p *PrismaComponent) NewMigration(b *project.Builder) *project.TaskBuilder
- func (p *PrismaComponent) ReadyTimeout(timeout time.Duration) *PrismaComponent
- func (p *PrismaComponent) Schema(path string) *PrismaComponent
- func (p *PrismaComponent) SourcePolicy(policy SourcePolicy) *PrismaComponent
- type PrismaDevDatabaseOptions
- type PrismaDevDatabaseResult
- type PrismaDevDatabaseSummary
- type PrismaDevelopmentStatus
- type PrismaMigration
- type PrismaMigrationApplyFunc
- type PrismaMigrationApplyOptions
- type PrismaMigrationAuthoringOptions
- type PrismaMigrationAuthoringResult
- type PrismaMigrationAuthoringSummary
- type PrismaMigrationGenerateOptions
- type PrismaRestorePlan
- type PrismaRestoreResult
- type PrismaSnapshot
- type PrismaState
- type RuntimeServiceHandle
- type RuntimeServiceOptions
- type SnapshotManifest
- type SourcePolicy
- type SourcePolicyFunc
Constants ¶
const ( DefaultPostgresImage = "postgres:16.14" DefaultSidecarImage = "alpine:3.24.1" DefaultContainerPort = 5432 FlavorPostgres = "postgres" FlavorPostGIS = "postgis" )
const (
ActionMigrationCreate = "devflow.database.migration.create"
)
Variables ¶
var (
ErrSnapshotIncompatible = errors.New("database snapshot is incompatible with the current runtime")
)
Functions ¶
func GeneratePrismaMigration ¶
func GeneratePrismaMigration(ctx context.Context, opts PrismaMigrationGenerateOptions) error
func MigrationSnapshotKey ¶
func MigrationSnapshotKey(state *MigrationState) string
func PrismaMigrateDeployCommand ¶
func PrismaMigrateDeployCommand(schemaPath string) process.CommandSpec
func PrismaMigrateDevCommand ¶
func PrismaMigrateDevCommand(schemaPath, name string, createOnly bool) process.CommandSpec
func PrismaSnapshotKey ¶
func PrismaSnapshotKey(state *PrismaState) string
func SnapshotKey ¶
Types ¶
type CommandSourcePolicy ¶
type CommandSourcePolicy struct {
PolicyName string
Spec process.CommandSpec
}
func (CommandSourcePolicy) Name ¶
func (p CommandSourcePolicy) Name() string
func (CommandSourcePolicy) PrepareBase ¶
func (p CommandSourcePolicy) PrepareBase(ctx context.Context, db api.DBInstance, opts PrepareOptions) error
type ManagedMigrationOptions ¶
type ManagedMigrationOptions struct {
Worktree string
DB api.DBInstance
MigrationsDir string
BasePaths []string
SourcePolicy SourcePolicy
Prepare PrepareOptions
Apply process.CommandSpec
ApplyEach MigrationApplyFunc
SnapshotKey string
ReadyTimeout time.Duration
}
type ManagedMigrationResult ¶
type ManagedMigrationResult struct {
State *MigrationState `json:"state,omitempty"`
Base *MigrationBaseResult `json:"base,omitempty"`
Applied bool `json:"applied"`
Snapshot *MigrationRestoreResult `json:"snapshot,omitempty"`
SnapshotKey string `json:"snapshotKey,omitempty"`
Plan MigrationRestorePlan `json:"plan"`
}
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func (*Manager) DestroyRuntime ¶
func (*Manager) EnsureMigratedDatabase ¶
func (m *Manager) EnsureMigratedDatabase(ctx context.Context, opts ManagedMigrationOptions) (*ManagedMigrationResult, error)
func (*Manager) EnsurePrismaDevDatabase ¶
func (m *Manager) EnsurePrismaDevDatabase(ctx context.Context, opts PrismaDevDatabaseOptions) (*PrismaDevDatabaseResult, error)
func (*Manager) EnsureRuntime ¶
func (*Manager) ExecSQL ¶
ExecSQL executes a SQL statement inside the managed Postgres container through the Docker Engine API. Output is returned even when psql fails.
func (*Manager) PrepareMigrationBase ¶
func (m *Manager) PrepareMigrationBase(ctx context.Context, db api.DBInstance, state *MigrationState, policy SourcePolicy, opts PrepareOptions) (*MigrationBaseResult, error)
func (*Manager) PreparePrismaBase ¶
func (m *Manager) PreparePrismaBase(ctx context.Context, db api.DBInstance, state *PrismaState, policy SourcePolicy, opts PrepareOptions) (*PrismaBaseResult, error)
func (*Manager) PreparePrismaMigrationAuthoringDatabase ¶
func (m *Manager) PreparePrismaMigrationAuthoringDatabase(ctx context.Context, opts PrismaMigrationAuthoringOptions) (*PrismaMigrationAuthoringResult, error)
func (*Manager) RestoreNearestMigrationSnapshot ¶
func (m *Manager) RestoreNearestMigrationSnapshot(ctx context.Context, db api.DBInstance, state *MigrationState) (*MigrationRestoreResult, error)
func (*Manager) RestoreNearestPrismaSnapshot ¶
func (m *Manager) RestoreNearestPrismaSnapshot(ctx context.Context, db api.DBInstance, state *PrismaState) (*PrismaRestoreResult, error)
func (*Manager) RestoreSnapshot ¶
func (m *Manager) RestoreSnapshot(ctx context.Context, db api.DBInstance, key string) (*SnapshotManifest, error)
func (*Manager) Snapshot ¶
func (m *Manager) Snapshot(ctx context.Context, db api.DBInstance, key string) (*SnapshotManifest, error)
func (*Manager) SnapshotMigrations ¶
func (m *Manager) SnapshotMigrations(ctx context.Context, db api.DBInstance, key string, state *MigrationState) (*MigrationRestoreResult, error)
func (*Manager) SnapshotPrisma ¶
func (m *Manager) SnapshotPrisma(ctx context.Context, db api.DBInstance, key string, state *PrismaState) (*PrismaRestoreResult, error)
func (*Manager) StartRuntimeService ¶
func (m *Manager) StartRuntimeService(ctx context.Context, db api.DBInstance, opts RuntimeServiceOptions) (*RuntimeServiceHandle, error)
StartRuntimeService ensures the database container is running and starts an Engine API log/wait stream. The returned handle stops the container when the owning task context is canceled.
func (*Manager) StopRuntime ¶
func (*Manager) WaitHostReady ¶
type MigrationApplyFunc ¶
type MigrationApplyFunc func(ctx context.Context, db api.DBInstance, migration MigrationPoint, opts MigrationApplyOptions) error
func PostgresMigrationFileApplier ¶
func PostgresMigrationFileApplier(fileName string) MigrationApplyFunc
type MigrationApplyOptions ¶
type MigrationBaseResult ¶
type MigrationBaseResult struct {
Restored *MigrationRestoreResult `json:"restored,omitempty"`
Recreated bool `json:"recreated"`
SourceApplied bool `json:"sourceApplied"`
SourcePolicy string `json:"sourcePolicy,omitempty"`
}
type MigrationNeededError ¶
func (*MigrationNeededError) Error ¶
func (e *MigrationNeededError) Error() string
func (*MigrationNeededError) MigrationNeeded ¶
func (e *MigrationNeededError) MigrationNeeded() bool
type MigrationPoint ¶
type MigrationRestorePlan ¶
type MigrationRestorePlan struct {
ExactMatch bool `json:"exactMatch"`
SnapshotKey string `json:"snapshotKey,omitempty"`
PrefixLength int `json:"prefixLength"`
Snapshot *MigrationSnapshot `json:"snapshot,omitempty"`
}
func PlanMigrationRestore ¶
func PlanMigrationRestore(root string, state *MigrationState) (MigrationRestorePlan, error)
type MigrationRestoreResult ¶
type MigrationRestoreResult struct {
Manifest *SnapshotManifest `json:"manifest,omitempty"`
Metadata *MigrationSnapshot `json:"metadata,omitempty"`
Plan MigrationRestorePlan `json:"plan"`
}
type MigrationSnapshot ¶
type MigrationSnapshot struct {
Version int `json:"version"`
Key string `json:"key"`
CreatedAt time.Time `json:"createdAt"`
BaseFingerprint string `json:"baseFingerprint,omitempty"`
PathHashes map[string]string `json:"pathHashes,omitempty"`
Migrations []MigrationPoint `json:"migrations"`
FullHash string `json:"fullHash"`
}
func LoadMigrationSnapshot ¶
func LoadMigrationSnapshot(root, key string) (*MigrationSnapshot, error)
func SaveMigrationSnapshot ¶
func SaveMigrationSnapshot(root, key string, state *MigrationState) (*MigrationSnapshot, error)
type MigrationState ¶
type MigrationState struct {
BaseFingerprint string `json:"baseFingerprint,omitempty"`
PathHashes map[string]string `json:"pathHashes,omitempty"`
Migrations []MigrationPoint `json:"migrations"`
FullHash string `json:"fullHash"`
}
func InspectMigrationState ¶
func InspectMigrationState(worktree, migrationsDir string, basePaths []string) (*MigrationState, error)
type PayloadCMSComponent ¶
type PayloadCMSComponent struct {
// contains filtered or unexported fields
}
func PayloadCMS ¶
func PayloadCMS(name string) *PayloadCMSComponent
func (*PayloadCMSComponent) AddPrompts ¶
func (p *PayloadCMSComponent) AddPrompts(prompts ...process.PromptSpec) *PayloadCMSComponent
func (*PayloadCMSComponent) AddSchemaInputs ¶
func (p *PayloadCMSComponent) AddSchemaInputs(inputs ...any) *PayloadCMSComponent
func (*PayloadCMSComponent) Command ¶
func (p *PayloadCMSComponent) Command(name string, args ...string) *PayloadCMSComponent
func (*PayloadCMSComponent) Config ¶
func (p *PayloadCMSComponent) Config(path string) *PayloadCMSComponent
func (*PayloadCMSComponent) Database ¶
func (p *PayloadCMSComponent) Database(db *PostgresComponent) *PayloadCMSComponent
func (*PayloadCMSComponent) ForceAcceptWarningsEnv ¶
func (p *PayloadCMSComponent) ForceAcceptWarningsEnv(key string) *PayloadCMSComponent
func (*PayloadCMSComponent) MigrationDir ¶
func (p *PayloadCMSComponent) MigrationDir(path string) *PayloadCMSComponent
func (*PayloadCMSComponent) MigrationNameEnv ¶
func (p *PayloadCMSComponent) MigrationNameEnv(key string) *PayloadCMSComponent
func (*PayloadCMSComponent) Migrations ¶
func (p *PayloadCMSComponent) Migrations(b *project.Builder) *project.TaskBuilder
func (*PayloadCMSComponent) NewMigration ¶
func (p *PayloadCMSComponent) NewMigration(b *project.Builder) *project.TaskBuilder
func (*PayloadCMSComponent) Prompts ¶
func (p *PayloadCMSComponent) Prompts(prompts ...process.PromptSpec) *PayloadCMSComponent
func (*PayloadCMSComponent) ReadyTimeout ¶
func (p *PayloadCMSComponent) ReadyTimeout(timeout time.Duration) *PayloadCMSComponent
func (*PayloadCMSComponent) SchemaInputs ¶
func (p *PayloadCMSComponent) SchemaInputs(inputs ...any) *PayloadCMSComponent
type PostgresComponent ¶
type PostgresComponent struct {
// contains filtered or unexported fields
}
func PostGIS ¶
func PostGIS(name string, postgresVersion int) *PostgresComponent
func Postgres ¶
func Postgres(name string) *PostgresComponent
func (*PostgresComponent) ContainerPort ¶
func (p *PostgresComponent) ContainerPort(port int) *PostgresComponent
func (*PostgresComponent) DatabaseName ¶
func (p *PostgresComponent) DatabaseName(name string) *PostgresComponent
func (*PostgresComponent) Image ¶
func (p *PostgresComponent) Image(image string) *PostgresComponent
func (*PostgresComponent) Password ¶
func (p *PostgresComponent) Password(password string) *PostgresComponent
func (*PostgresComponent) PortName ¶
func (p *PostgresComponent) PortName(name string) *PostgresComponent
func (*PostgresComponent) SidecarImage ¶
func (p *PostgresComponent) SidecarImage(image string) *PostgresComponent
func (*PostgresComponent) SnapshotRoot ¶
func (p *PostgresComponent) SnapshotRoot(path string) *PostgresComponent
func (*PostgresComponent) User ¶
func (p *PostgresComponent) User(user string) *PostgresComponent
type PostgresDumpSourcePolicy ¶
func (PostgresDumpSourcePolicy) Name ¶
func (p PostgresDumpSourcePolicy) Name() string
func (PostgresDumpSourcePolicy) PrepareBase ¶
func (p PostgresDumpSourcePolicy) PrepareBase(ctx context.Context, db api.DBInstance, opts PrepareOptions) error
type PrepareOptions ¶
type PrepareOptions struct {
Worktree string
Env map[string]string
LogPath string
OnLine func(stream, line string)
}
func PrepareOptionsFromRuntime ¶
func PrepareOptionsFromRuntime(rt *project.Runtime) PrepareOptions
type PrismaBaseResult ¶
type PrismaBaseResult struct {
Restored *PrismaRestoreResult `json:"restored,omitempty"`
Recreated bool `json:"recreated"`
SourceApplied bool `json:"sourceApplied"`
SourcePolicy string `json:"sourcePolicy,omitempty"`
}
type PrismaComponent ¶
type PrismaComponent struct {
// contains filtered or unexported fields
}
func Prisma ¶
func Prisma(name string) *PrismaComponent
func (*PrismaComponent) BasePaths ¶
func (p *PrismaComponent) BasePaths(paths ...string) *PrismaComponent
func (*PrismaComponent) Client ¶
func (p *PrismaComponent) Client(b *project.Builder) *project.TaskBuilder
func (*PrismaComponent) CloneFromEnv ¶
func (p *PrismaComponent) CloneFromEnv(key string) *PrismaComponent
func (*PrismaComponent) Database ¶
func (p *PrismaComponent) Database(db *PostgresComponent) *PrismaComponent
func (*PrismaComponent) MigrationDir ¶
func (p *PrismaComponent) MigrationDir(path string) *PrismaComponent
func (*PrismaComponent) Migrations ¶
func (p *PrismaComponent) Migrations(b *project.Builder) *project.TaskBuilder
func (*PrismaComponent) NewMigration ¶
func (p *PrismaComponent) NewMigration(b *project.Builder) *project.TaskBuilder
func (*PrismaComponent) ReadyTimeout ¶
func (p *PrismaComponent) ReadyTimeout(timeout time.Duration) *PrismaComponent
func (*PrismaComponent) Schema ¶
func (p *PrismaComponent) Schema(path string) *PrismaComponent
func (*PrismaComponent) SourcePolicy ¶
func (p *PrismaComponent) SourcePolicy(policy SourcePolicy) *PrismaComponent
type PrismaDevDatabaseOptions ¶
type PrismaDevDatabaseOptions struct {
Worktree string
DB api.DBInstance
SchemaPath string
MigrationsDir string
BasePaths []string
SourcePolicy SourcePolicy
Prepare PrepareOptions
Migrate process.CommandSpec
MigrateEach PrismaMigrationApplyFunc
SnapshotKey string
ReadyTimeout time.Duration
}
type PrismaDevDatabaseResult ¶
type PrismaDevDatabaseResult struct {
State *PrismaState `json:"state,omitempty"`
Base *PrismaBaseResult `json:"base,omitempty"`
Applied bool `json:"applied"`
Snapshot *PrismaRestoreResult `json:"snapshot,omitempty"`
SnapshotKey string `json:"snapshotKey,omitempty"`
Plan PrismaRestorePlan `json:"plan"`
}
func EnsurePrismaDevDatabaseForRuntime ¶
func EnsurePrismaDevDatabaseForRuntime(ctx context.Context, rt *project.Runtime, opts PrismaDevDatabaseOptions) (*PrismaDevDatabaseResult, error)
type PrismaDevDatabaseSummary ¶
type PrismaDevDatabaseSummary struct {
Applied bool `json:"applied"`
SnapshotKey string `json:"snapshotKey,omitempty"`
PlanSnapshot string `json:"planSnapshot,omitempty"`
ExactMatch bool `json:"exactMatch"`
PrefixLength int `json:"prefixLength"`
MigrationCount int `json:"migrationCount"`
MigrationNames []string `json:"migrationNames,omitempty"`
Restored bool `json:"restored"`
RestoredSnapshot string `json:"restoredSnapshot,omitempty"`
RestoredExactMatch bool `json:"restoredExactMatch"`
RestoredPrefixLength int `json:"restoredPrefixLength"`
Recreated bool `json:"recreated"`
SourceApplied bool `json:"sourceApplied"`
SourcePolicy string `json:"sourcePolicy,omitempty"`
}
func SummarizePrismaDevDatabase ¶
func SummarizePrismaDevDatabase(result *PrismaDevDatabaseResult) PrismaDevDatabaseSummary
type PrismaDevelopmentStatus ¶
type PrismaDevelopmentStatus struct {
State *PrismaState `json:"state,omitempty"`
Plan PrismaRestorePlan `json:"plan"`
NeedsNewMigration bool `json:"needsNewMigration"`
Reason string `json:"reason,omitempty"`
Message string `json:"message,omitempty"`
}
func InspectPrismaDevelopmentStatus ¶
func InspectPrismaDevelopmentStatus(worktree, schemaPath, migrationsDir string, extraPaths []string, snapshotRoot string) (*PrismaDevelopmentStatus, error)
type PrismaMigration ¶
type PrismaMigrationApplyFunc ¶
type PrismaMigrationApplyFunc func(ctx context.Context, db api.DBInstance, migration PrismaMigration, opts PrismaMigrationApplyOptions) error
func PrismaMigrateDeployPrefixApplier ¶
func PrismaMigrateDeployPrefixApplier() PrismaMigrationApplyFunc
type PrismaMigrationAuthoringOptions ¶
type PrismaMigrationAuthoringOptions struct {
Worktree string
DB api.DBInstance
SchemaPath string
MigrationsDir string
BasePaths []string
SourcePolicy SourcePolicy
Prepare PrepareOptions
MigrateEach PrismaMigrationApplyFunc
ReadyTimeout time.Duration
}
type PrismaMigrationAuthoringResult ¶
type PrismaMigrationAuthoringResult struct {
State *PrismaState `json:"state,omitempty"`
Base *PrismaBaseResult `json:"base,omitempty"`
Plan PrismaRestorePlan `json:"plan"`
Applied bool `json:"applied"`
AppliedMigrations []string `json:"appliedMigrations,omitempty"`
}
func PreparePrismaMigrationAuthoringDatabaseForRuntime ¶
func PreparePrismaMigrationAuthoringDatabaseForRuntime(ctx context.Context, rt *project.Runtime, opts PrismaMigrationAuthoringOptions) (*PrismaMigrationAuthoringResult, error)
type PrismaMigrationAuthoringSummary ¶
type PrismaMigrationAuthoringSummary struct {
Applied bool `json:"applied"`
AppliedMigrations []string `json:"appliedMigrations,omitempty"`
PlanSnapshot string `json:"planSnapshot,omitempty"`
ExactMatch bool `json:"exactMatch"`
PrefixLength int `json:"prefixLength"`
MigrationCount int `json:"migrationCount"`
MigrationNames []string `json:"migrationNames,omitempty"`
Restored bool `json:"restored"`
RestoredSnapshot string `json:"restoredSnapshot,omitempty"`
RestoredExactMatch bool `json:"restoredExactMatch"`
RestoredPrefixLength int `json:"restoredPrefixLength"`
Recreated bool `json:"recreated"`
SourceApplied bool `json:"sourceApplied"`
SourcePolicy string `json:"sourcePolicy,omitempty"`
}
func SummarizePrismaMigrationAuthoring ¶
func SummarizePrismaMigrationAuthoring(result *PrismaMigrationAuthoringResult) PrismaMigrationAuthoringSummary
type PrismaRestorePlan ¶
type PrismaRestorePlan struct {
ExactMatch bool `json:"exactMatch"`
SnapshotKey string `json:"snapshotKey,omitempty"`
PrefixLength int `json:"prefixLength"`
Snapshot *PrismaSnapshot `json:"snapshot,omitempty"`
}
func PlanPrismaRestore ¶
func PlanPrismaRestore(root string, state *PrismaState) (PrismaRestorePlan, error)
type PrismaRestoreResult ¶
type PrismaRestoreResult struct {
Manifest *SnapshotManifest `json:"manifest,omitempty"`
Metadata *PrismaSnapshot `json:"metadata,omitempty"`
Plan PrismaRestorePlan `json:"plan"`
}
type PrismaSnapshot ¶
type PrismaSnapshot struct {
Version int `json:"version"`
Key string `json:"key"`
CreatedAt time.Time `json:"createdAt"`
SchemaHash string `json:"schemaHash"`
BaseFingerprint string `json:"baseFingerprint,omitempty"`
PathHashes map[string]string `json:"pathHashes,omitempty"`
Migrations []PrismaMigration `json:"migrations"`
FullHash string `json:"fullHash"`
}
func LoadPrismaSnapshot ¶
func LoadPrismaSnapshot(root, key string) (*PrismaSnapshot, error)
func SavePrismaSnapshot ¶
func SavePrismaSnapshot(root, key string, state *PrismaState) (*PrismaSnapshot, error)
type PrismaState ¶
type PrismaState struct {
SchemaHash string `json:"schemaHash"`
BaseFingerprint string `json:"baseFingerprint,omitempty"`
PathHashes map[string]string `json:"pathHashes,omitempty"`
Migrations []PrismaMigration `json:"migrations"`
FullHash string `json:"fullHash"`
}
func InspectPrismaState ¶
func InspectPrismaState(worktree, schemaPath, migrationsDir string, extraPaths []string) (*PrismaState, error)
type RuntimeServiceHandle ¶
type RuntimeServiceHandle struct {
// contains filtered or unexported fields
}
RuntimeServiceHandle adapts a Docker-managed database container to Devflow's generic supervised-service lifecycle without a wrapper process.
func (*RuntimeServiceHandle) Alive ¶
func (h *RuntimeServiceHandle) Alive() bool
func (*RuntimeServiceHandle) PID ¶
func (h *RuntimeServiceHandle) PID() int
PID returns zero because the supervised resource is an Engine-managed container rather than an operating-system child process.
func (*RuntimeServiceHandle) Stop ¶
func (h *RuntimeServiceHandle) Stop() error
func (*RuntimeServiceHandle) Wait ¶
func (h *RuntimeServiceHandle) Wait() error
type RuntimeServiceOptions ¶
type RuntimeServiceOptions struct {
OnLine func(stream, line string)
}
RuntimeServiceOptions controls managed-container log delivery. OnLine is called with "stdout" or "stderr" and a single line without its newline.
type SnapshotManifest ¶
type SnapshotManifest struct {
Version int `json:"version"`
Key string `json:"key"`
CreatedAt time.Time `json:"createdAt"`
Image string `json:"image"`
Platform string `json:"platform,omitempty"`
PostgresVersion int `json:"postgresVersion,omitempty"`
SidecarImage string `json:"sidecarImage,omitempty"`
ContainerName string `json:"containerName"`
VolumeName string `json:"volumeName"`
Database string `json:"database"`
User string `json:"user"`
Port int `json:"port"`
ContainerPort int `json:"containerPort,omitempty"`
ArchivePath string `json:"archivePath"`
}
func LoadSnapshot ¶
func LoadSnapshot(path string) (*SnapshotManifest, error)
type SourcePolicy ¶
type SourcePolicy interface {
Name() string
PrepareBase(ctx context.Context, db api.DBInstance, opts PrepareOptions) error
}
type SourcePolicyFunc ¶
type SourcePolicyFunc struct {
PolicyName string
Fn func(ctx context.Context, db api.DBInstance, opts PrepareOptions) error
}
func (SourcePolicyFunc) Name ¶
func (p SourcePolicyFunc) Name() string
func (SourcePolicyFunc) PrepareBase ¶
func (p SourcePolicyFunc) PrepareBase(ctx context.Context, db api.DBInstance, opts PrepareOptions) error