SchemaCompiler
final class SchemaCompiler (View source)
Turns schema blueprints and immutable table definitions into driver-specific SQL statements.
Methods
Creates a compiler that delegates dialect-specific SQL to the selected grammar.
Compiles the primary create-table statement for consumers that expect one SQL string.
Materializes a blueprint once and returns all statements required by the grammar.
Compiles the primary SQL statement for an immutable table definition.
Compiles all statements for an immutable table definition, including driver-specific indexes or constraints.
Materializes an alteration blueprint and compiles its statements without executing them.
Compiles a drop-table operation with optional existence protection.
Compiles a table rename operation.
Compiles creation of a database namespace.
Compiles removal of a database namespace.
Details
__construct
__construct(SchemaGrammarInterface $grammar)
Creates a compiler that delegates dialect-specific SQL to the selected grammar.
compileCreate
string
compileCreate(string $table, Closure $definition, bool $ifNotExists = false)
Compiles the primary create-table statement for consumers that expect one SQL string.
compileCreateStatements
array
compileCreateStatements(string $table, Closure $definition, bool $ifNotExists = false)
Materializes a blueprint once and returns all statements required by the grammar.
compileCreateTable
string
compileCreateTable(TableDefinition $definition)
Compiles the primary SQL statement for an immutable table definition.
compileCreateTableStatements
array
compileCreateTableStatements(TableDefinition $definition)
Compiles all statements for an immutable table definition, including driver-specific indexes or constraints.
compileTable
array
compileTable(string $table, Closure $definition)
Materializes an alteration blueprint and compiles its statements without executing them.
compileDrop
string
compileDrop(string $table, bool $ifExists = false)
Compiles a drop-table operation with optional existence protection.
compileRename
string
compileRename(string $from, string $to)
Compiles a table rename operation.
compileCreateDatabase
string
compileCreateDatabase(string $database)
Compiles creation of a database namespace.
compileDropDatabase
string
compileDropDatabase(string $database)
Compiles removal of a database namespace.