DatabaseMigrationRepository implements MigrationRepositoryInterface
MigrationRepository Class.
Repository used to store all migrations run against the database
Tags
Table of Contents
$db | Manager | |
---|---|---|
$table | string | |
$connection | string | |
__construct() | Create a new database migration repository instance. | mixed |
getMigrationsList() | Get the list of ran migrations. | array |
getMigrations() | Get list of migrations. | array |
getMigration() | Get details about a specific migration. | stdClass |
getLast() | Get the last migration batch in reserve order they were ran (last one first). | array |
log() | Log that a migration was run. | mixed |
delete() | Remove a migration from the log. | mixed |
getNextBatchNumber() | Get the next migration batch number. | int |
getLastBatchNumber() | Get the last migration batch number. | int |
createRepository() | Create the migration repository data store. | mixed |
deleteRepository() | Delete the migration repository data store. | mixed |
repositoryExists() | Determine if the migration repository exists. | bool |
table() | Get a query builder for the migration table. | Builder |
getSchemaBuilder() | Returns the schema builder instance. | Builder |
getConnection() | Resolve the database connection instance. | Connection |
setSource() | Set the information source to gather data. | mixed |
Properties
$db
protected
Manager
$db
$table
protected
string
$table
$connection
protected
string
$connection
Methods
__construct()
Create a new database migration repository instance.
public
__construct(
$db :
Manager
[, $table :
string
= 'migrations' ]
)
: mixed
Parameters
- $db : Manager
- $table : string = 'migrations'
Return values
mixedgetMigrationsList()
Get the list of ran migrations.
public
getMigrationsList(
[ $steps :
int
= -1 ]
[, $order :
string
= 'asc' ]
)
: array
Parameters
- $steps : int = -1
Number of batch to return
- $order : string = 'asc'
asc|desc
Return values
array —An array of migration class names in the order they where ran
getMigrations()
Get list of migrations.
public
getMigrations(
[ $steps :
int
= -1 ]
[, $order :
string
= 'asc' ]
)
: array
Parameters
- $steps : int = -1
Number of batch to return
- $order : string = 'asc'
asc|desc
Return values
arraygetMigration()
Get details about a specific migration.
public
getMigration(
$migration :
string
)
: stdClass
Parameters
- $migration : string
The migration class
Return values
stdClass —The migration info
getLast()
Get the last migration batch in reserve order they were ran (last one first).
public
getLast(
)
: array
Return values
arraylog()
Log that a migration was run.
public
log(
$file :
string
, $batch :
int
[, $sprinkle :
string
= '' ]
)
: mixed
Parameters
- $file : string
- $batch : int
- $sprinkle : string = ''
Return values
mixeddelete()
Remove a migration from the log.
public
delete(
$migration :
string
)
: mixed
Parameters
- $migration : string
Return values
mixedgetNextBatchNumber()
Get the next migration batch number.
public
getNextBatchNumber(
)
: int
Return values
intgetLastBatchNumber()
Get the last migration batch number.
public
getLastBatchNumber(
)
: int
Return values
intcreateRepository()
Create the migration repository data store.
public
createRepository(
)
: mixed
Return values
mixeddeleteRepository()
Delete the migration repository data store.
public
deleteRepository(
)
: mixed
Return values
mixedrepositoryExists()
Determine if the migration repository exists.
public
repositoryExists(
)
: bool
Return values
booltable()
Get a query builder for the migration table.
protected
table(
)
: Builder
Return values
BuildergetSchemaBuilder()
Returns the schema builder instance.
public
getSchemaBuilder(
)
: Builder
Return values
BuildergetConnection()
Resolve the database connection instance.
public
getConnection(
)
: Connection
Return values
ConnectionsetSource()
Set the information source to gather data.
public
setSource(
$name :
string
)
: mixed
Parameters
- $name : string
The source name