Documentation

Migrator extends AbstractMigrator
in package

Sql migrator class

Tags
category

Pop

author

Nick Sagona, III dev@nolainteractive.com

copyright

Copyright (c) 2009-2024 NOLA Interactive, LLC. (http://www.nolainteractive.com)

license

http://www.popphp.org/license New BSD License

version
6.5.0

Table of Contents

Properties

$current  : string|null
Current migration position
$db  : AbstractAdapter|null
Database adapter
$migrations  : array<string|int, mixed>
Migrations
$path  : string|null
Migration path

Methods

__construct()  : mixed
Constructor
create()  : string
Create new migration file
createTable()  : Migrator
Create table
db()  : AbstractAdapter
Get the DB adapter (alias method)
getByBatch()  : array<string|int, mixed>
Get migrations by batch
getCurrent()  : string|null
Get the migration path
getCurrentBatch()  : int
Get current batch
getDb()  : AbstractAdapter
Get the DB adapter
getNextBatch()  : int
Get next batch
getPath()  : string|null
Get the migration path
getTable()  : string
Get table class string
hasTable()  : bool
Determine if the migration source has a table in the DB
isFile()  : bool
Determine if the migration source is stored in a file
isTable()  : bool
Determine if the migration source is stored in a DB
rollback()  : Migrator
Roll back the migrator (down/backward direction)
rollbackAll()  : Migrator
Roll back all the migrator (down/backward direction)
run()  : Migrator
Run the migrator (up/forward direction)
runAll()  : Migrator
Run all the migrator (up/forward direction)
setPath()  : Migrator
Set the migration path and get migration files
clearCurrent()  : void
Clear migrations
deleteCurrent()  : void
Delete migration
loadCurrent()  : void
Load the current migration timestamp
storeCurrent()  : void
Store the current migration timestamp

Properties

$current

Current migration position

protected string|null $current = null

$migrations

Migrations

protected array<string|int, mixed> $migrations = []

$path

Migration path

protected string|null $path = null

Methods

create()

Create new migration file

public static create(string $class[, string|null $path = null ]) : string
Parameters
$class : string
$path : string|null = null
Tags
throws
Exception
Return values
string

getByBatch()

Get migrations by batch

public getByBatch(string|int $batch) : array<string|int, mixed>
Parameters
$batch : string|int
Return values
array<string|int, mixed>

getCurrent()

Get the migration path

public getCurrent() : string|null
Return values
string|null

getCurrentBatch()

Get current batch

public getCurrentBatch() : int
Return values
int

getNextBatch()

Get next batch

public getNextBatch() : int
Return values
int

getPath()

Get the migration path

public getPath() : string|null
Return values
string|null

getTable()

Get table class string

public getTable() : string
Return values
string

hasTable()

Determine if the migration source has a table in the DB

public hasTable() : bool
Return values
bool

isFile()

Determine if the migration source is stored in a file

public isFile() : bool
Return values
bool

isTable()

Determine if the migration source is stored in a DB

public isTable() : bool
Return values
bool

rollback()

Roll back the migrator (down/backward direction)

public rollback([mixed $steps = 1 ]) : Migrator
Parameters
$steps : mixed = 1
Return values
Migrator

rollbackAll()

Roll back all the migrator (down/backward direction)

public rollbackAll() : Migrator
Return values
Migrator

run()

Run the migrator (up/forward direction)

public run([mixed $steps = 1 ]) : Migrator
Parameters
$steps : mixed = 1
Return values
Migrator

setPath()

Set the migration path and get migration files

public setPath(string $path) : Migrator
Parameters
$path : string
Tags
throws
Exception
Return values
Migrator

clearCurrent()

Clear migrations

protected clearCurrent() : void

deleteCurrent()

Delete migration

protected deleteCurrent(int $current[, int|null $previous = null ]) : void
Parameters
$current : int
$previous : int|null = null

loadCurrent()

Load the current migration timestamp

protected loadCurrent() : void

storeCurrent()

Store the current migration timestamp

protected storeCurrent(int $current, string $classFile[, int|null $batch = null ]) : void
Parameters
$current : int
$classFile : string
$batch : int|null = null

        
On this page

Search results