Builder
class Builder (View source)
Properties
protected Connection | $connection | The database connection instance. | |
protected Grammar | $grammar | The schema grammar instance. | |
protected Closure | $resolver | The Blueprint resolver callback. | |
static int | $defaultStringLength | The default string length for migrations. |
Methods
void | __construct(Connection $connection) Create a new database Schema manager. | |
static void | defaultStringLength(int $length) Set the default string length for migrations. | |
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. | |
bool | hasColumns(string $table, array $columns) Determine if the given table has given columns. | |
string | getColumnType(string $table, string $column) Get the data type for the given column name. | |
array | getColumnListing(string $table) Get the column listing for a given table. | |
void | table(string $table, Closure $callback) Modify a table on the schema. | |
void | create(string $table, Closure $callback) Create a new table on the schema. | |
void | drop(string $table) Drop a table from the schema. | |
void | dropIfExists(string $table) Drop a table from the schema if it exists. | |
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. | |
bool | enableForeignKeyConstraints() Enable foreign key constraints. | |
bool | disableForeignKeyConstraints() Disable foreign key constraints. | |
void | build(Blueprint $blueprint) Execute the blueprint to build / modify the table. | |
Blueprint | createBlueprint(string $table, Closure $callback = null) Create a new command set with a Closure. | |
void | registerCustomDoctrineType(string $class, string $name, string $type) Register a custom Doctrine mapping type. | |
Connection | getConnection() Get the database connection instance. | |
$this | setConnection(Connection $connection) Set the database connection instance. | |
void | blueprintResolver(Closure $resolver) Set the Schema Blueprint resolver callback. |
Details
void __construct(Connection $connection)
Create a new database Schema manager.
static void defaultStringLength(int $length)
Set the default string length for migrations.
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.
bool hasColumns(string $table, array $columns)
Determine if the given table has given columns.
string getColumnType(string $table, string $column)
Get the data type for the given column name.
array getColumnListing(string $table)
Get the column listing for a given table.
void table(string $table, Closure $callback)
Modify a table on the schema.
void create(string $table, Closure $callback)
Create a new table on the schema.
void drop(string $table)
Drop a table from the schema.
void dropIfExists(string $table)
Drop a table from the schema if it exists.
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.
bool enableForeignKeyConstraints()
Enable foreign key constraints.
bool disableForeignKeyConstraints()
Disable foreign key constraints.
protected void build(Blueprint $blueprint)
Execute the blueprint to build / modify the table.
protected Blueprint createBlueprint(string $table, Closure $callback = null)
Create a new command set with a Closure.
void registerCustomDoctrineType(string $class, string $name, string $type)
Register a custom Doctrine mapping type.
Connection getConnection()
Get the database connection instance.
$this setConnection(Connection $connection)
Set the database connection instance.
void blueprintResolver(Closure $resolver)
Set the Schema Blueprint resolver callback.
© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/7.x/Illuminate/Database/Schema/Builder.html