PostgresBuilder
extends Builder
in package
Table of Contents
- $defaultStringLength : int
- The default string length for migrations.
- $connection : Connection
- The database connection instance.
- $grammar : Grammar
- The schema grammar instance.
- $resolver : Closure
- The Blueprint resolver callback.
- __construct() : void
- Create a new database Schema manager.
- blueprintResolver() : void
- Set the Schema Blueprint resolver callback.
- create() : void
- Create a new table on the schema.
- defaultStringLength() : void
- Set the default string length for migrations.
- disableForeignKeyConstraints() : bool
- Disable foreign key constraints.
- drop() : void
- Drop a table from the schema.
- dropAllTables() : void
- Drop all tables from the database.
- dropIfExists() : void
- Drop a table from the schema if it exists.
- enableForeignKeyConstraints() : bool
- Enable foreign key constraints.
- getColumnListing() : array<string|int, mixed>
- Get the column listing for a given table.
- getColumnType() : string
- Get the data type for the given column name.
- getConnection() : Connection
- Get the database connection instance.
- hasColumn() : bool
- Determine if the given table has a given column.
- hasColumns() : bool
- Determine if the given table has given columns.
- hasTable() : bool
- Determine if the given table exists.
- rename() : void
- Rename a table on the schema.
- setConnection() : $this
- Set the database connection instance.
- table() : void
- Modify a table on the schema.
- build() : void
- Execute the blueprint to build / modify the table.
- createBlueprint() : Blueprint
- Create a new command set with a Closure.
- getAllTables() : array<string|int, mixed>
- Get all of the table names for the database.
- parseSchemaAndTable() : array<string|int, mixed>
- Parse the table name and extract the schema and table.
Properties
$defaultStringLength
The default string length for migrations.
public
static int
$defaultStringLength
= 255
$connection
The database connection instance.
protected
Connection
$connection
$grammar
The schema grammar instance.
protected
Grammar
$grammar
$resolver
The Blueprint resolver callback.
protected
Closure
$resolver
Methods
__construct()
Create a new database Schema manager.
public
__construct(Connection $connection) : void
Parameters
- $connection : Connection
Return values
void —blueprintResolver()
Set the Schema Blueprint resolver callback.
public
blueprintResolver(Closure $resolver) : void
Parameters
- $resolver : Closure
Return values
void —create()
Create a new table on the schema.
public
create(string $table, Closure $callback) : void
Parameters
- $table : string
- $callback : Closure
Return values
void —defaultStringLength()
Set the default string length for migrations.
public
static defaultStringLength(int $length) : void
Parameters
- $length : int
Return values
void —disableForeignKeyConstraints()
Disable foreign key constraints.
public
disableForeignKeyConstraints() : bool
Return values
bool —drop()
Drop a table from the schema.
public
drop(string $table) : void
Parameters
- $table : string
Return values
void —dropAllTables()
Drop all tables from the database.
public
dropAllTables() : void
Return values
void —dropIfExists()
Drop a table from the schema if it exists.
public
dropIfExists(string $table) : void
Parameters
- $table : string
Return values
void —enableForeignKeyConstraints()
Enable foreign key constraints.
public
enableForeignKeyConstraints() : bool
Return values
bool —getColumnListing()
Get the column listing for a given table.
public
getColumnListing(string $table) : array<string|int, mixed>
Parameters
- $table : string
Return values
array<string|int, mixed> —getColumnType()
Get the data type for the given column name.
public
getColumnType(string $table, string $column) : string
Parameters
- $table : string
- $column : string
Return values
string —getConnection()
Get the database connection instance.
public
getConnection() : Connection
Return values
Connection —hasColumn()
Determine if the given table has a given column.
public
hasColumn(string $table, string $column) : bool
Parameters
- $table : string
- $column : string
Return values
bool —hasColumns()
Determine if the given table has given columns.
public
hasColumns(string $table, array<string|int, mixed> $columns) : bool
Parameters
- $table : string
- $columns : array<string|int, mixed>
Return values
bool —hasTable()
Determine if the given table exists.
public
hasTable(string $table) : bool
Parameters
- $table : string
Return values
bool —rename()
Rename a table on the schema.
public
rename(string $from, string $to) : void
Parameters
- $from : string
- $to : string
Return values
void —setConnection()
Set the database connection instance.
public
setConnection(Connection $connection) : $this
Parameters
- $connection : Connection
Return values
$this —table()
Modify a table on the schema.
public
table(string $table, Closure $callback) : void
Parameters
- $table : string
- $callback : Closure
Return values
void —build()
Execute the blueprint to build / modify the table.
protected
build(Blueprint $blueprint) : void
Parameters
- $blueprint : Blueprint
Return values
void —createBlueprint()
Create a new command set with a Closure.
protected
createBlueprint(string $table[, Closure|null $callback = null ]) : Blueprint
Parameters
- $table : string
- $callback : Closure|null = null
Return values
Blueprint —getAllTables()
Get all of the table names for the database.
protected
getAllTables() : array<string|int, mixed>
Return values
array<string|int, mixed> —parseSchemaAndTable()
Parse the table name and extract the schema and table.
protected
parseSchemaAndTable(string $table) : array<string|int, mixed>
Parameters
- $table : string