Schema
final class Schema (View source)
Compiles and executes schema changes through the active driver's grammar and query interface.
Methods
Creates a schema executor bound to the configured grammar and database driver.
Defines and executes a new table, optionally tolerating a pre-existing table.
Executes a previously materialized table definition without invoking a blueprint callback.
Defines and executes alterations for an existing table in grammar-defined statement order.
Drops a table, optionally allowing an absent table without treating it as a failure.
Renames one table through the active grammar's identifier rules.
Creates a database through the active driver's schema grammar.
Drops a database through the active driver's schema grammar.
Compiles the first create-table statement for callers that require SQL without execution.
Compiles every statement required to create a table, including grammar-specific auxiliary statements.
Compiles every statement required to alter an existing table without executing them.
Compiles a drop-table statement using the active grammar.
Compiles a table rename statement using the active grammar.
Details
__construct
__construct(SchemaCompiler $compiler, DatabaseDriverInterface $db)
Creates a schema executor bound to the configured grammar and database driver.
create
bool
create(string $table, Closure $definition, bool $ifNotExists = false)
Defines and executes a new table, optionally tolerating a pre-existing table.
createTable
bool
createTable(TableDefinition $definition)
Executes a previously materialized table definition without invoking a blueprint callback.
table
bool
table(string $table, Closure $definition)
Defines and executes alterations for an existing table in grammar-defined statement order.
drop
bool
drop(string $table, bool $ifExists = false)
Drops a table, optionally allowing an absent table without treating it as a failure.
rename
bool
rename(string $from, string $to)
Renames one table through the active grammar's identifier rules.
createDatabase
bool
createDatabase(string $database)
Creates a database through the active driver's schema grammar.
dropDatabase
bool
dropDatabase(string $database)
Drops a database through the active driver's schema grammar.
compileCreate
string
compileCreate(string $table, Closure $definition, bool $ifNotExists = false)
Compiles the first create-table statement for callers that require SQL without execution.
compileCreateStatements
array
compileCreateStatements(string $table, Closure $definition, bool $ifNotExists = false)
Compiles every statement required to create a table, including grammar-specific auxiliary statements.
compileTable
array
compileTable(string $table, Closure $definition)
Compiles every statement required to alter an existing table without executing them.
compileDrop
string
compileDrop(string $table, bool $ifExists = false)
Compiles a drop-table statement using the active grammar.
compileRename
string
compileRename(string $from, string $to)
Compiles a table rename statement using the active grammar.