Builder
class Builder (View source)
Traits
Properties
static protected array | $macros | The registered string macros. |
from Macroable |
protected Connection | $connection | The database connection instance. |
|
protected Grammar | $grammar | The schema grammar instance. |
|
protected Closure | $resolver | The Blueprint resolver callback. |
|
static int|null | $defaultStringLength | The default string length for migrations. |
|
static | $defaultTimePrecision | The default time precision for migrations. |
|
static string | $defaultMorphKeyType | The default relationship morph key type. |
Methods
Mix another object into the class.
Dynamically handle calls to the class.
Dynamically handle calls to the class.
Set the default string length for migrations.
Set the default time precision for migrations.
Set the default morph key type for migrations.
Set the default morph key type for migrations to UUIDs.
Set the default morph key type for migrations to ULIDs.
Create a database in the schema.
Drop a database from the schema if the database exists.
Get the schemas that belong to the connection.
Determine if the given table exists.
Determine if the given view exists.
Get the tables that belong to the connection.
Get the names of the tables that belong to the connection.
Get the views that belong to the connection.
Get the user-defined types that belong to the connection.
Determine if the given table has a given column.
Determine if the given table has given columns.
Execute a table builder callback if the given table has a given column.
Execute a table builder callback if the given table doesn't have a given column.
Get the data type for the given column name.
Get the column listing for a given table.
Get the columns for a given table.
Get the indexes for a given table.
Get the names of the indexes for a given table.
Determine if the given table has a given index.
Get the foreign keys for a given table.
Drop a table from the schema.
Drop a table from the schema if it exists.
Drop columns from a table schema.
Drop all tables from the database.
Drop all views from the database.
Drop all types from the database.
Rename a table on the schema.
Enable foreign key constraints.
Disable foreign key constraints.
Disable foreign key constraints during the execution of a callback.
Create a new command set with a Closure.
Get the names of the current schemas for the connection.
Get the default schema name for the connection.
Parse the given database object reference and extract the schema and table.
Get the database connection instance.
Details
static void
defaultTimePrecision(int|null $precision)
Set the default time precision for migrations.
array
getTableListing(string|string[]|null $schema = null, bool $schemaQualified = true)
Get the names of the tables that belong to the connection.
array
getTypes(string|string[]|null $schema = null)
Get the user-defined types that belong to the connection.
void
whenTableHasColumn(string $table, string $column, Closure $callback)
Execute a table builder callback if the given table has a given column.
void
whenTableDoesntHaveColumn(string $table, string $column, Closure $callback)
Execute a table builder callback if the given table doesn't have a given column.
string
getColumnType(string $table, string $column, bool $fullDefinition = false)
Get the data type for the given column name.
bool
hasIndex(string $table, string|array $index, string|null $type = null)
Determine if the given table has a given index.
mixed
withoutForeignKeyConstraints(Closure $callback)
Disable foreign key constraints during the execution of a callback.
protected Blueprint
createBlueprint(string $table, Closure|null $callback = null)
Create a new command set with a Closure.