W3cubDocs

/Laravel 8

PostgresBuilder

class PostgresBuilder extends Builder (View source)

Properties

protected Connection $connection The database connection instance. from Builder
protected Grammar $grammar The schema grammar instance. from Builder
protected Closure $resolver The Blueprint resolver callback. from Builder
static int $defaultStringLength The default string length for migrations. from Builder
static string $defaultMorphKeyType The default relationship morph key type. from Builder

Methods

void __construct(Connection $connection)

Create a new database Schema manager.

from Builder
static void defaultStringLength(int $length)

Set the default string length for migrations.

from Builder
static void defaultMorphKeyType(string $type)

Set the default morph key type for migrations.

from Builder
static void morphUsingUuids()

Set the default morph key type for migrations to UUIDs.

from Builder
bool hasTable(string $table)

Determine if the given table exists.

bool hasColumn(string $table, string $column)

Determine if the given table has a given column.

from Builder
bool hasColumns(string $table, array $columns)

Determine if the given table has given columns.

from Builder
string getColumnType(string $table, string $column)

Get the data type for the given column name.

from Builder
array getColumnListing(string $table)

Get the column listing for a given table.

void table(string $table, Closure $callback)

Modify a table on the schema.

from Builder
void create(string $table, Closure $callback)

Create a new table on the schema.

from Builder
void drop(string $table)

Drop a table from the schema.

from Builder
void dropIfExists(string $table)

Drop a table from the schema if it exists.

from Builder
void dropColumns(string $table, string|array $columns)

Drop columns from a table schema.

from Builder
void dropAllTables()

Drop all tables from the database.

void dropAllViews()

Drop all views from the database.

void dropAllTypes()

Drop all types from the database.

void getAllTables()

Get all of the table names for the database.

void rename(string $from, string $to)

Rename a table on the schema.

from Builder
bool enableForeignKeyConstraints()

Enable foreign key constraints.

from Builder
bool disableForeignKeyConstraints()

Disable foreign key constraints.

from Builder
void build(Blueprint $blueprint)

Execute the blueprint to build / modify the table.

from Builder
Blueprint createBlueprint(string $table, Closure $callback = null)

Create a new command set with a Closure.

from Builder
void registerCustomDoctrineType(string $class, string $name, string $type)

Register a custom Doctrine mapping type.

from Builder
Connection getConnection()

Get the database connection instance.

from Builder
$this setConnection(Connection $connection)

Set the database connection instance.

from Builder
void blueprintResolver(Closure $resolver)

Set the Schema Blueprint resolver callback.

from Builder
array getAllViews()

Get all of the view names for the database.

array getAllTypes()

Get all of the type names for the database.

array parseSchemaAndTable(string $table)

Parse the table name and extract the schema and table.

Details

void __construct(Connection $connection)

Create a new database Schema manager.

Parameters

Connection $connection

Return Value

void

static void defaultStringLength(int $length)

Set the default string length for migrations.

Parameters

int $length

Return Value

void

static void defaultMorphKeyType(string $type)

Set the default morph key type for migrations.

Parameters

string $type

Return Value

void

static void morphUsingUuids()

Set the default morph key type for migrations to UUIDs.

Return Value

void

bool hasTable(string $table)

Determine if the given table exists.

Parameters

string $table

Return Value

bool

bool hasColumn(string $table, string $column)

Determine if the given table has a given column.

Parameters

string $table
string $column

Return Value

bool

bool hasColumns(string $table, array $columns)

Determine if the given table has given columns.

Parameters

string $table
array $columns

Return Value

bool

string getColumnType(string $table, string $column)

Get the data type for the given column name.

Parameters

string $table
string $column

Return Value

string

array getColumnListing(string $table)

Get the column listing for a given table.

Parameters

string $table

Return Value

array

void table(string $table, Closure $callback)

Modify a table on the schema.

Parameters

string $table
Closure $callback

Return Value

void

void create(string $table, Closure $callback)

Create a new table on the schema.

Parameters

string $table
Closure $callback

Return Value

void

void drop(string $table)

Drop a table from the schema.

Parameters

string $table

Return Value

void

void dropIfExists(string $table)

Drop a table from the schema if it exists.

Parameters

string $table

Return Value

void

void dropColumns(string $table, string|array $columns)

Drop columns from a table schema.

Parameters

string $table
string|array $columns

Return Value

void

void dropAllTables()

Drop all tables from the database.

Return Value

void

void dropAllViews()

Drop all views from the database.

Return Value

void

void dropAllTypes()

Drop all types from the database.

Return Value

void

void getAllTables()

Get all of the table names for the database.

Return Value

void

void rename(string $from, string $to)

Rename a table on the schema.

Parameters

string $from
string $to

Return Value

void

bool enableForeignKeyConstraints()

Enable foreign key constraints.

Return Value

bool

bool disableForeignKeyConstraints()

Disable foreign key constraints.

Return Value

bool

protected void build(Blueprint $blueprint)

Execute the blueprint to build / modify the table.

Parameters

Blueprint $blueprint

Return Value

void

protected Blueprint createBlueprint(string $table, Closure $callback = null)

Create a new command set with a Closure.

Parameters

string $table
Closure $callback

Return Value

Blueprint

void registerCustomDoctrineType(string $class, string $name, string $type)

Register a custom Doctrine mapping type.

Parameters

string $class
string $name
string $type

Return Value

void

Exceptions

DBALException
RuntimeException

Connection getConnection()

Get the database connection instance.

Return Value

Connection

$this setConnection(Connection $connection)

Set the database connection instance.

Parameters

Connection $connection

Return Value

$this

void blueprintResolver(Closure $resolver)

Set the Schema Blueprint resolver callback.

Parameters

Closure $resolver

Return Value

void

array getAllViews()

Get all of the view names for the database.

Return Value

array

array getAllTypes()

Get all of the type names for the database.

Return Value

array

protected array parseSchemaAndTable(string $table)

Parse the table name and extract the schema and table.

Parameters

string $table

Return Value

array

© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/8.x/Illuminate/Database/Schema/PostgresBuilder.html