KMP PHP API Reference

TenantMigrateCommand extends Command
in package

Runs tenant application and plugin migrations with platform job logging.

Table of Contents

Constants

JOB_TYPE  : mixed = 'tenant_migration'
OUTCOME_COMPLETED  : mixed = 'completed'
OUTCOME_FAILED  : mixed = 'failed'
OUTCOME_SKIPPED  : mixed = 'skipped'
PLATFORM_CONNECTION  : mixed = 'platform'
TENANT_CONNECTION  : mixed = \App\Services\TenantConnectionManager::CONNECTI...

Properties

$lockManager  : TenantMigrationLockManagerInterface|null
$migrationCatalog  : TenantMigrationCatalog|null
$migrationMarkerService  : TenantMigrationMarkerServiceInterface|null
$migrationRunner  : TenantMigrationRunnerInterface|null
$migrationStateInspector  : TenantMigrationStateInspectorInterface|null
$tenantConnectionManager  : TenantConnectionManager|null

Methods

defaultName()  : string
execute()  : int|null
scrubError()  : string
Remove secret-like values before writing platform job errors.
setLockManager()  : void
Override advisory locking for tests.
setMigrationMarkerService()  : void
Override pre-migration marker creation for tests.
setMigrationRunner()  : void
Override migration execution for tests.
setMigrationStateInspector()  : void
Override tenant migration inspection for tests.
setTenantConnectionManager()  : void
Override tenant connection scoping for tests.
buildOptionParser()  : ConsoleOptionParser
assertMarkerOnlyOptions()  : void
assertNoMigrationHistoryDrift()  : void
Refuse to operate when database history contains migrations absent from this image.
assertReleaseCompatibility()  : void
assertSafeSlug()  : void
Validate tenant slug syntax before querying metadata.
assertSelector()  : void
Validate that exactly one target selector was supplied.
assertTenantCurrent()  : void
Verify that migration execution reached every app and plugin target.
assertTenantDatabaseConfig()  : void
Fail closed when required tenant database metadata is missing.
executeMigrationCommand()  : void
insertJob()  : void
isStandardReleaseMigration()  : bool
Standard deploy migrations can be planned, skipped, and verified against latest.
lockManager()  : TenantMigrationLockManagerInterface
Get the advisory lock manager.
migrateTenant()  : string
migrationCatalog()  : TenantMigrationCatalog
Get the migration catalog shared by planning and result verification.
migrationCommandArgs()  : array<int, string>
migrationMarkerService()  : TenantMigrationMarkerServiceInterface
Get the pre-migration marker service.
migrationOptions()  : array<string, mixed>
migrationStateInspector()  : TenantMigrationStateInspectorInterface
Get the release migration-state inspector.
now()  : string
Current UTC timestamp for platform rows.
platform()  : Connection
Get the platform metadata connection.
pluginsWithMigrations()  : array<int, string>
printStatus()  : void
readSchemaVersion()  : string|null
Read the current Phinx schema version from the tenant database.
resolveTenants()  : array<int, TenantMetadata>
runCakeMigrations()  : void
runTenantMigration()  : TenantMigrationResult
tenantConnectionManager()  : TenantConnectionManager
Get the tenant connection manager.

Constants

TENANT_CONNECTION

private mixed TENANT_CONNECTION = \App\Services\TenantConnectionManager::CONNECTION_ALIAS

Properties

Methods

execute()

public execute(Arguments $args, ConsoleIo $io) : int|null
Parameters
$args : Arguments
$io : ConsoleIo
Tags
inheritDoc
Return values
int|null

scrubError()

Remove secret-like values before writing platform job errors.

public static scrubError(string $message) : string
Parameters
$message : string
Return values
string

buildOptionParser()

protected buildOptionParser(ConsoleOptionParser $parser) : ConsoleOptionParser
Parameters
$parser : ConsoleOptionParser
Tags
inheritDoc
Return values
ConsoleOptionParser

assertMarkerOnlyOptions()

private assertMarkerOnlyOptions(array<string, mixed> $options) : void
Parameters
$options : array<string, mixed>

assertSafeSlug()

Validate tenant slug syntax before querying metadata.

private assertSafeSlug(string $slug) : void
Parameters
$slug : string

assertSelector()

Validate that exactly one target selector was supplied.

private assertSelector(Arguments $args) : void
Parameters
$args : Arguments

executeMigrationCommand()

private executeMigrationCommand(MigrateCommand $command, array<int, string> $args, ConsoleIo $io, string $label) : void
Parameters
$command : MigrateCommand
$args : array<int, string>
$io : ConsoleIo
$label : string

isStandardReleaseMigration()

Standard deploy migrations can be planned, skipped, and verified against latest.

private isStandardReleaseMigration(array<string, mixed> $options) : bool
Parameters
$options : array<string, mixed>
Return values
bool

migrationCommandArgs()

private migrationCommandArgs(array{target?: string|null, date?: string|null, fake?: bool, dry_run?: bool, manifest?: string|null} $options) : array<int, string>
Parameters
$options : array{target?: string|null, date?: string|null, fake?: bool, dry_run?: bool, manifest?: string|null}
Return values
array<int, string>

migrationOptions()

private migrationOptions(Arguments $args) : array<string, mixed>
Parameters
$args : Arguments
Return values
array<string, mixed>

now()

Current UTC timestamp for platform rows.

private now() : string
Return values
string

platform()

Get the platform metadata connection.

private platform() : Connection
Return values
Connection

pluginsWithMigrations()

private pluginsWithMigrations() : array<int, string>
Return values
array<int, string>

readSchemaVersion()

Read the current Phinx schema version from the tenant database.

private readSchemaVersion() : string|null
Return values
string|null

runCakeMigrations()

private runCakeMigrations(array{target?: string|null, date?: string|null, fake?: bool, dry_run?: bool, manifest?: string|null} $options, ConsoleIo $io) : void
Parameters
$options : array{target?: string|null, date?: string|null, fake?: bool, dry_run?: bool, manifest?: string|null}
$io : ConsoleIo
On this page

Search results