Table
class Table
A table is used to create a migration plan
Properties
| protected string | $name | ||
| protected array | $columns | ||
| protected array | $dependencies |
Methods
Create a new table (doesn't run CREATE TABLE)
Get name
Returns true if depends on other tables
Add an auto increment primary column
Adds created and modified timestamps
Alias for integer
Compute dependencies
Remove satisfied dependency and return new list
Get query string
Attemp to create a table with 'create table' instruction
Drop the table
Details
at line 32
__construct(string $model)
Create a new table (doesn't run CREATE TABLE)
at line 42
string
name()
Get name
at line 52
Column[]
columns()
Get columns
at line 62
bool
dependent()
Returns true if depends on other tables
at line 75
id(string $name = "id", int $size = 16)
Add an auto increment primary column
at line 83
timestamps()
Adds created and modified timestamps
at line 97
Column
string(string $name, int $size = 255)
Add a string (varchar) column with an optional size
at line 110
Column
integer(string $name, int $size = 16)
Add an integer column with an optional size
at line 120
int($name, $size = 16)
Alias for integer
at line 133
Column
uint(string $name, int $size = 16)
Add an unsigned int column with an optional size
at line 145
Column
bool(string $name)
Add a boolean column (using TINYINT(1))
at line 157
Column
timestamp(string $name)
Add a timestamp column
at line 169
Column
json(string $name)
Add a json column
at line 182
Column
add(string $name, string $type)
Add column to table
at line 199
array
generateDependencies()
Compute dependencies
Compute dependencies based on column Used to build dependency treea and compute migration order
at line 218
array
removeDependency(string $table)
Remove satisfied dependency and return new list
at line 236
string
createQuery()
Get query string
at line 328
bool
create(string $schema = "master")
Attemp to create a table with 'create table' instruction
at line 340
bool
drop(string $schema = "master")
Drop the table
at line 353
bool
migrate(Table $old = null, string $schema = "master")
Run migration for this table