Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
breyta
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Thomas Flori
breyta
Commits
2e5ca546
Unverified
Commit
2e5ca546
authored
6 years ago
by
Thomas Flori
Browse files
Options
Downloads
Patches
Plain Diff
update reference
parent
7771e04f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
reference.md
+495
-66
495 additions, 66 deletions
reference.md
with
495 additions
and
66 deletions
reference.md
+
495
−
66
View file @
2e5ca546
...
@@ -7,6 +7,7 @@
...
@@ -7,6 +7,7 @@
*
[
AdapterInterface
](
#breytaadapterinterface
)
*
[
AdapterInterface
](
#breytaadapterinterface
)
*
[
BasicAdapter
](
#breytabasicadapter
)
*
[
BasicAdapter
](
#breytabasicadapter
)
*
[
CallbackProgress
](
#breytacallbackprogress
)
*
[
CallbackProgress
](
#breytacallbackprogress
)
*
[
Migrations
](
#breytamigrations
)
*
[
ProgressInterface
](
#breytaprogressinterface
)
*
[
ProgressInterface
](
#breytaprogressinterface
)
...
@@ -93,6 +94,171 @@ Returns false on error and an integer of affected rows on success.
...
@@ -93,6 +94,171 @@ Returns false on error and an integer of affected rows on success.
*
http://php.net/manual/en/pdo.exec.php - for a details about the return statement
*
http://php.net/manual/en/pdo.exec.php - for a details about the return statement
-
--
### Breyta\ProgressInterface
#### Methods
*
[
afterExecution
](
#breytaprogressinterfaceafterexecution
)
Output information about the $statement (after it gets executed)
*
[
afterMigration
](
#breytaprogressinterfaceaftermigration
)
Output information about the $migration (after the migration)
*
[
beforeExecution
](
#breytaprogressinterfacebeforeexecution
)
Output information about the $statement (before it gets executed)
*
[
beforeMigration
](
#breytaprogressinterfacebeforemigration
)
Output information about the $migration (before the migration)
*
[
finish
](
#breytaprogressinterfacefinish
)
Output information about what just happened
*
[
start
](
#breytaprogressinterfacestart
)
Output information about starting the migration process
#### Breyta\ProgressInterface::afterExecution
```
php
public
function
afterExecution
(
\Breyta\Model\Statement
$execution
)
```
##### Output information about the $statement (after it gets executed)
**Visibility:**
this method is
**public**
.
<br
/>
##### Parameters
| Parameter | Type | Description |
|-----------|------|-------------|
|
`$execution`
|
**Model\Statement**
| |
#### Breyta\ProgressInterface::afterMigration
```
php
public
function
afterMigration
(
\Breyta\Model\Migration
$migration
)
```
##### Output information about the $migration (after the migration)
**Visibility:**
this method is
**public**
.
<br
/>
##### Parameters
| Parameter | Type | Description |
|-----------|------|-------------|
|
`$migration`
|
**Model\Migration**
| |
#### Breyta\ProgressInterface::beforeExecution
```
php
public
function
beforeExecution
(
\Breyta\Model\Statement
$execution
)
```
##### Output information about the $statement (before it gets executed)
**Visibility:**
this method is
**public**
.
<br
/>
##### Parameters
| Parameter | Type | Description |
|-----------|------|-------------|
|
`$execution`
|
**Model\Statement**
| |
#### Breyta\ProgressInterface::beforeMigration
```
php
public
function
beforeMigration
(
\Breyta\Model\Migration
$migration
)
```
##### Output information about the $migration (before the migration)
**Visibility:**
this method is
**public**
.
<br
/>
##### Parameters
| Parameter | Type | Description |
|-----------|------|-------------|
|
`$migration`
|
**Model\Migration**
| |
#### Breyta\ProgressInterface::finish
```
php
public
function
finish
(
\stdClass
$info
)
```
##### Output information about what just happened
Info contains:
-
`migrations`
- an array of Breyta
\M
odel
\M
igration
-
`task`
- the task that is going to be executed (migrate or revert)
-
`count`
- an integer how many migrations are going to be executed
-
`executed`
- an array of migrations that just got executed
**Visibility:**
this method is
**public**
.
<br
/>
##### Parameters
| Parameter | Type | Description |
|-----------|------|-------------|
|
`$info`
|
**\stdClass**
| |
#### Breyta\ProgressInterface::start
```
php
public
function
start
(
\stdClass
$info
)
```
##### Output information about starting the migration process
Info contains:
-
`migrations`
- an array of Breyta
\M
odel
\M
igration
-
`task`
- the task that is going to be executed (migrate or revert)
-
`count`
- an integer how many migrations are going to be executed
-
`toExecute`
- an array of migrations that are going to be executed
**Visibility:**
this method is
**public**
.
<br
/>
##### Parameters
| Parameter | Type | Description |
|-----------|------|-------------|
|
`$info`
|
**\stdClass**
| |
---
---
### Breyta\Model\Migration
### Breyta\Model\Migration
...
@@ -164,7 +330,7 @@ public static function createInstance( array $data = array() )
...
@@ -164,7 +330,7 @@ public static function createInstance( array $data = array() )
-
--
-
--
### Breyta\
ProgressInterface
### Breyta\
Model\Statement
...
@@ -174,24 +340,32 @@ public static function createInstance( array $data = array() )
...
@@ -174,24 +340,32 @@ public static function createInstance( array $data = array() )
#### Properties
| Visibility | Name | Type | Description |
|------------|------|------|---------------------------------------|
|
**public**
|
`$raw`
|
**string**
| |
|
**public**
|
`$teaser`
|
**string**
| |
|
**public**
|
`$action`
|
**string**
| |
|
**public**
|
`$type`
|
**string**
| |
|
**public**
|
`$name`
|
**string**
| |
|
**public**
|
`$result`
|
**mixed**
| |
|
**public**
|
`$executionTime`
|
**double**
| |
|
**public**
|
`$exception`
|
**
\
PDOException
**
| |
#### Methods
#### Methods
*
[
afterExecution
]
(#breytaprogressinterfaceafterexecution) Output information about the $statement (after it gets executed)
*
[
__toString
](
#breytamodelstatement__tostring
)
*
[
afterMigration
]
(#breytaprogressinterfaceaftermigration) Output information about the $migration (after the migration)
*
[
createInstance
](
#breytamodelstatementcreateinstance
)
*
[
beforeExecution
]
(#breytaprogressinterfacebeforeexecution) Output information about the $statement (before it gets executed)
*
[
beforeMigration
]
(#breytaprogressinterfacebeforemigration) Output information about the $migration (before the migration)
*
[
finish
]
(#breytaprogressinterfacefinish) Output information about what just happened
*
[
start
]
(#breytaprogressinterfacestart) Output information about starting the migration process
#### Breyta\
ProgressInterface::afterExecution
#### Breyta\
Model\Statement::__toString
```
php
```
php
public function
afterExecution( \Breyta\Model\Statement $execution
)
public
function
__toString
(
)
```
```
##### Output information about the $statement (after it gets executed)
...
@@ -199,21 +373,97 @@ public function afterExecution( \Breyta\Model\Statement $execution )
...
@@ -199,21 +373,97 @@ public function afterExecution( \Breyta\Model\Statement $execution )
<br
/>
<br
/>
#### Breyta\Model\Statement::createInstance
```
php
public
static
function
createInstance
(
array
$data
=
array
()
)
```
**Static:**
this method is
**static**
.
<br
/>
**Visibility:**
this method is
**public**
.
<br
/>
##### Parameters
##### Parameters
| Parameter | Type | Description |
| Parameter | Type | Description |
|-----------|------|-------------|
|-----------|------|-------------|
|
`$execution` | **Model\Statement** | |
|
`$data`
|
**array**
| |
---
### Breyta\Migrations
#
### Breyta\ProgressInterface::afterMigration
The migration engine that puts all parts together.
#### Constants
|
Name
|
Value
|
|
------|-------|
|
INTERNAL_PREFIX | `'@breyta/'` |
#
### Properties
|
Visibility | Name | Type | Description |
|
------------|------|------|---------------------------------------|
|
**public static** | `$table` | **string** | The name of the migration table |
|
**public static** | `$templatePath` | **string** | The path to the template for migrations |
|
**protected** | `$db` | ** \ PDO** | |
|
**protected** | `$path` | **string** | |
|
**protected** | `$migrations` | **array | array<Model \ Migration>** | |
|
**protected** | `$missingMigrations` | **array | array<Model \ Migration>** | |
|
**protected** | `$statements` | **array | array<Model \ Statement>** | |
|
**protected** | `$adapter` | **AdapterInterface** | |
|
**protected** | `$resolver` | **callable** | |
|
**protected** | `$progress` | **ProgressInterface** | |
#
### Methods
*
[__construct](#breytamigrations__construct)
*
[createMigration](#breytamigrationscreatemigration) Creates a migration
*
[down](#breytamigrationsdown) Revert specific migrations
*
[executeStatement](#breytamigrationsexecutestatement)
*
[findMigrations](#breytamigrationsfindmigrations)
*
[getAdapter](#breytamigrationsgetadapter)
*
[getProgress](#breytamigrationsgetprogress)
*
[getStatus](#breytamigrationsgetstatus) Returns the status of the migrations
*
[internalClass](#breytamigrationsinternalclass)
*
[isInternal](#breytamigrationsisinternal)
*
[loadMigrations](#breytamigrationsloadmigrations)
*
[migrate](#breytamigrationsmigrate) Migrate all migrations that are not migrated yet
*
[migrateTo](#breytamigrationsmigrateto) Migrate all migrations to a specific migration or date time
*
[revert](#breytamigrationsrevert) Revert all migrations that have been migrated
*
[revertTo](#breytamigrationsrevertto) Revert all migrations to a specific migration or date time
*
[saveMigration](#breytamigrationssavemigration)
*
[setProgress](#breytamigrationssetprogress)
*
[up](#breytamigrationsup) Migrate specific migrations
#
### Breyta\Migrations::__construct
`
``php
`
``php
p
ublic function afterMigration( \Breyta\Model\Migration $migration )
p
ublic function __construct(
\PDO $db, \Breyta\string $path, callable $resolver = null,
\Breyta\ProgressInterface $progress = null
)
: Migrations
`
``
`
``
#
#### Output information about the $migration (after the migration)
...
@@ -225,21 +475,69 @@ public function afterMigration( \Breyta\Model\Migration $migration )
...
@@ -225,21 +475,69 @@ public function afterMigration( \Breyta\Model\Migration $migration )
|
Parameter | Type | Description |
|
Parameter | Type | Description |
|
-----------|------|-------------|
|
-----------|------|-------------|
|
`$migration` | **Model\Migration** | |
|
`$db` | **\PDO** | |
|
`$path` | **string** | |
|
`$resolver` | **callable** | |
|
`$progress` | **ProgressInterface** | |
#
### Breyta\
ProgressInterface::beforeExecu
tion
#
### Breyta\
Migrations::createMigra
tion
`
``php
`
``php
p
ublic function
beforeExecution( \Breyta\Model\Statement $execution )
p
ublic function
createMigration( string $name ): boolean
`
``
`
``
#
#### Output information about the $statement (before it gets executed)
#
#### Creates a migration
W
e recommend StudlyCase naming for PSR2 compatibility. Also the files will get a namespace.
*
*Visibility:** this method is **public**.
<
br />
**Returns**: this method returns **boolean**
<
br />
#
#### Parameters
|
Parameter | Type | Description |
|
-----------|------|-------------|
|
`$name` | **string** | |
#
### Breyta\Migrations::down
`
``php
p
ublic function down( \Breyta\Model\Migration $migrations ): boolean
`
``
#
#### Revert specific migrations
*
*Visibility:** this method is **public**.
*
*Visibility:** this method is **public**.
<
br />
**Returns**: this method returns **boolean**
<
br />
#
#### Parameters
|
Parameter | Type | Description |
|
-----------|------|-------------|
|
`$migrations` | **Model\Migration** | |
#
### Breyta\Migrations::executeStatement
`
``php
p
rotected function executeStatement( \Breyta\Model\Statement $statement )
`
``
*
*Visibility:** this method is **protected**.
<
br />
<
br />
...
@@ -247,21 +545,84 @@ public function beforeExecution( \Breyta\Model\Statement $execution )
...
@@ -247,21 +545,84 @@ public function beforeExecution( \Breyta\Model\Statement $execution )
|
Parameter | Type | Description |
|
Parameter | Type | Description |
|
-----------|------|-------------|
|
-----------|------|-------------|
|
`$
execution
` | **Model\Statement** | |
|
`$
statement
` | **Model\Statement** | |
#
### Breyta\
ProgressInterface::before
Migration
#
### Breyta\
Migrations::find
Migration
s
`
``php
`
``php
p
ublic
function
beforeMigration( \Breyta\Model\Migration $migration
)
p
rotected
function
findMigrations(
)
`
``
`
``
#
#### Output information about the $migration (before the migration)
*
*Visibility:** this method is **protected**.
<
br />
#
### Breyta\Migrations::getAdapter
`
``php
p
rotected function getAdapter()
`
``
*
*Visibility:** this method is **protected**.
<
br />
#
### Breyta\Migrations::getProgress
`
``php
p
ublic function getProgress()
`
``
*
*Visibility:** this method is **public**.
<
br />
#
### Breyta\Migrations::getStatus
`
``php
p
ublic function getStatus(): \stdClass
`
``
#
#### Returns the status of the migrations
I
t contains an array of all migrations, the count of migrations that are not migrated yet and an array of
m
igrations that got removed (if files where removed).
*
*Visibility:** this method is **public**.
*
*Visibility:** this method is **public**.
<
br />
**Returns**: this method returns **\stdClass**
<
br />
#
### Breyta\Migrations::internalClass
`
``php
p
rotected static function internalClass( \Breyta\string $file )
`
``
*
*Static:** this method is **static**.
<
br />**Visibility:** this method is **protected**.
<
br />
<
br />
...
@@ -269,25 +630,21 @@ public function beforeMigration( \Breyta\Model\Migration $migration )
...
@@ -269,25 +630,21 @@ public function beforeMigration( \Breyta\Model\Migration $migration )
|
Parameter | Type | Description |
|
Parameter | Type | Description |
|
-----------|------|-------------|
|
-----------|------|-------------|
|
`$
migration` | **Model\Migration
** | |
|
`$
file` | **string
** | |
#
### Breyta\
ProgressInterface::finish
#
### Breyta\
Migrations::isInternal
`
``php
`
``php
p
ublic function finish( \stdClass $info
)
p
rotected static function isInternal( \Breyta\string $file
)
`
``
`
``
#
#### Output information about what just happened
I
nfo contains:
- `migrations` - an array of Breyta\Model\Migration
- `task` - the task that is going to be executed (migrate or revert)
- `count` - an integer how many migrations are going to be executed
- `executed` - an array of migrations that just got executed
*
*Visibility:** this method is **public**.
*
*Static:** this method is **static**.
<
br />**Visibility:** this method is **protected**.
<
br />
<
br />
...
@@ -295,96 +652,145 @@ Info contains:
...
@@ -295,96 +652,145 @@ Info contains:
|
Parameter | Type | Description |
|
Parameter | Type | Description |
|
-----------|------|-------------|
|
-----------|------|-------------|
|
`$
info
` | **
\
st
dClass
** | |
|
`$
file
` | **st
ring
** | |
#
### Breyta\
ProgressInterface::start
#
### Breyta\
Migrations::loadMigrations
`
``php
`
``php
p
ublic
function
start( \stdClass $info
)
p
rotected
function
loadMigrations(
)
`
``
`
``
#
#### Output information about starting the migration process
I
nfo contains:
- `migrations` - an array of Breyta\Model\Migration
- `task` - the task that is going to be executed (migrate or revert)
*
*Visibility:** this method is **protected**.
- `count` - an integer how many migrations are going to be executed
<
br />
- `toExecute` - an array of migrations that are going to be executed
#
### Breyta\Migrations::migrate
`
``php
p
ublic function migrate(): boolean
`
``
#
#### Migrate all migrations that are not migrated yet
*
*Visibility:** this method is **public**.
*
*Visibility:** this method is **public**.
<
br />
<
br />
**Returns**: this method returns **boolean**
<
br />
#
### Breyta\Migrations::migrateTo
`
``php
p
ublic function migrateTo( string $file ): boolean
`
``
#
#### Migrate all migrations to a specific migration or date time
$
file can either be a relative file name (or a portion matched with `strpos()`) or a date time string to execute
a
ll migrations to that time.
*
*Visibility:** this method is **public**.
<
br />
**Returns**: this method returns **boolean**
<
br />
#
#### Parameters
#
#### Parameters
|
Parameter | Type | Description |
|
Parameter | Type | Description |
|
-----------|------|-------------|
|
-----------|------|-------------|
|
`$
info
` | **
\
st
dClass
** | |
|
`$
file
` | **st
ring
** | |
#
### Breyta\Migrations::revert
`
``php
p
ublic function revert(): boolean
`
``
-
--
#
#### Revert all migrations that have been migrated
### Breyta\Model\Statement
*
*Visibility:** this method is **public**.
<
br />
**Returns**: this method returns **boolean**
<
br />
#
### Breyta\Migrations::revertTo
`
``php
p
ublic function revertTo( string $file ): boolean
`
``
#
#### Revert all migrations to a specific migration or date time
$
file can either be a relative file name (or a portion matched with `strpos()`) or a date time string to execute
a
ll migrations to that time.
#### Properties
*
*Note:** This will not revert the migration matched the pattern. It is resetting to the state of the database
t
o the state when <file> was executed.
| Visibility | Name | Type | Description |
*
*Visibility:** this method is **public**.
|------------|------|------|---------------------------------------|
<
br />
|
**public**
|
`$raw`
|
**string**
| |
**Returns**: this method returns **boolean**
|
**public**
|
`$teaser`
|
**string**
| |
<
br />
|
**public**
|
`$action`
|
**string**
| |
|
**public**
|
`$type`
|
**string**
| |
|
**public**
|
`$name`
|
**string**
| |
|
**public**
|
`$result`
|
**mixed**
| |
|
**public**
|
`$executionTime`
|
**double**
| |
|
**public**
|
`$exception`
|
**
\
PDOException
**
| |
#
#### Parameters
|
Parameter | Type | Description |
|
-----------|------|-------------|
|
`$file` | **string** | |
#### Methods
*
[
__toString
](
#breytamodelstatement__tostring
)
*
[
createInstance
](
#breytamodelstatementcreateinstance
)
#### Breyta\M
odel\Statement::__toString
#
### Breyta\M
igrations::saveMigration
`
``php
`
``php
public
function
__toString
()
p
rotected function saveMigration(
\Breyta\Model\Migration $migration, $status, $executionTime
)
`
``
`
``
**Visibility:**
this method is
**p
ublic
**
.
*
*Visibility:** this method is **p
rotected
**.
<
br />
<
br />
#
#### Parameters
|
Parameter | Type | Description |
|
-----------|------|-------------|
|
`$migration` | **Model\Migration** | |
|
`$status` | | |
|
`$executionTime` | | |
#### Breyta\M
odel\Statement::createInstance
#
### Breyta\M
igrations::setProgress
`
``php
`
``php
public
static
function
createInstance
(
array
$data
=
array
()
)
p
ublic function
setProgress( \Breyta\ProgressInterface $progress
)
`
``
`
``
**Static:**
this method is
**static**
.
*
*Visibility:** this method is **public**.
<br
/>
**Visibility:**
this method is
**public**
.
<
br />
<
br />
...
@@ -392,7 +798,30 @@ public static function createInstance( array $data = array() )
...
@@ -392,7 +798,30 @@ public static function createInstance( array $data = array() )
|
Parameter | Type | Description |
|
Parameter | Type | Description |
|
-----------|------|-------------|
|
-----------|------|-------------|
|
`$data`
|
**array**
| |
|
`$progress` | **ProgressInterface** | |
#
### Breyta\Migrations::up
`
``php
p
ublic function up( \Breyta\Model\Migration $migrations ): boolean
`
``
#
#### Migrate specific migrations
*
*Visibility:** this method is **public**.
<
br />
**Returns**: this method returns **boolean**
<
br />
#
#### Parameters
|
Parameter | Type | Description |
|
-----------|------|-------------|
|
`$migrations` | **Model\Migration** | |
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment