Primordyx Framework Documentation

MigrateCommand extends AbstractCommand
in package

Table of Contents

Methods

execute()  : void
Execute the migrate command
getDescription()  : string
Get the command description
getDetailedHelp()  : string
Get detailed help text for this command
getName()  : string
Get the command name
error()  : never
Output an error and exit
out()  : void
Output a message
getMigrationsPath()  : string
Get migrations path from database config or command line override
isAbsolute()  : bool
Check if a path is absolute
parseOptions()  : array<string|int, mixed>
Parse command line options
runCreate()  : void
Create new migration files
runDown()  : void
Rollback migrations
runFake()  : void
Mark migrations as executed without running them
runReset()  : void
Reset all migrations
runStatus()  : void
Show migration status
runTemplates()  : void
Show available migration templates
runUp()  : void
Run pending migrations
showCreateHelp()  : void
Show detailed help for create command

Methods

execute()

Execute the migrate command

public execute(array<string|int, mixed> $args) : void
Parameters
$args : array<string|int, mixed>

Command line arguments

Tags
throws
Exception

If migration execution fails

throws
RuntimeException

If configuration is invalid

throws
InvalidArgumentException

If arguments are invalid

throws
Throwable

If unexpected error occurs

getDescription()

Get the command description

public getDescription() : string
Tags
inheritDoc
Return values
string

A brief description of what this command does

getDetailedHelp()

Get detailed help text for this command

public getDetailedHelp() : string
Tags
inheritDoc
Return values
string

getName()

Get the command name

public getName() : string
Tags
inheritDoc
Return values
string

The unique name identifier for this command

error()

Output an error and exit

protected error(string $message) : never
Parameters
$message : string
Return values
never

out()

Output a message

protected out(string $message) : void
Parameters
$message : string

getMigrationsPath()

Get migrations path from database config or command line override

private getMigrationsPath(array<string|int, mixed> $options) : string
Parameters
$options : array<string|int, mixed>

Parsed command line options

Tags
throws
RuntimeException

If path cannot be determined or does not exist

Return values
string

Absolute path to migrations directory

isAbsolute()

Check if a path is absolute

private isAbsolute(string $path) : bool
Parameters
$path : string

Path to check

Return values
bool

True if path is absolute

parseOptions()

Parse command line options

private parseOptions(array<string|int, mixed> $args) : array<string|int, mixed>
Parameters
$args : array<string|int, mixed>
Return values
array<string|int, mixed>

runCreate()

Create new migration files

private runCreate(array<string|int, mixed> $args) : void
Parameters
$args : array<string|int, mixed>
Tags
throws
Exception

If migration generation fails

throws
RuntimeException

If configuration is invalid

throws
InvalidArgumentException

If arguments are invalid

throws
Throwable

If unexpected error occurs

runDown()

Rollback migrations

private runDown(array<string|int, mixed> $args) : void
Parameters
$args : array<string|int, mixed>
Tags
throws
Exception

If rollback fails

throws
Throwable

If unexpected error occurs

runFake()

Mark migrations as executed without running them

private runFake(array<string|int, mixed> $args) : void
Parameters
$args : array<string|int, mixed>
Tags
throws
Exception

If marking fails

runReset()

Reset all migrations

private runReset(array<string|int, mixed> $args) : void
Parameters
$args : array<string|int, mixed>
Tags
throws
Exception

If reset fails

throws
Throwable

If unexpected error occurs

runStatus()

Show migration status

private runStatus(array<string|int, mixed> $args) : void
Parameters
$args : array<string|int, mixed>
Tags
throws
Exception

If migration execution fails

throws
RuntimeException

If configuration is invalid

throws
InvalidArgumentException

If arguments are invalid

throws
Throwable

If unexpected error occurs

runTemplates()

Show available migration templates

private runTemplates(array<string|int, mixed> $args) : void
Parameters
$args : array<string|int, mixed>
Tags
throws
Exception

If template discovery fails

throws
RuntimeException

If MigrationGenerator cannot be instantiated

throws
Throwable

If unexpected error occurs

runUp()

Run pending migrations

private runUp(array<string|int, mixed> $args) : void
Parameters
$args : array<string|int, mixed>
Tags
throws
Exception

If migration execution fails

throws
Throwable

If unexpected error occurs

showCreateHelp()

Show detailed help for create command

private showCreateHelp() : void

        
On this page

Search results