MysqlSchemaGrammar
final class MysqlSchemaGrammar implements SchemaGrammarInterface (View source)
Compiles framework schema definitions to MySQL and MariaDB DDL with configured table prefixes.
Constants
| private UNSIGNED_TYPES |
|
Methods
Creates a grammar with the configured table prefix and SQL value escaper.
Compiles MySQL database creation with a validated database identifier.
Compiles MySQL database removal with a validated database identifier.
Compiles the primary CREATE TABLE statement for one immutable table definition.
Compiles every statement required to create a table and its deferred constraints.
Compiles ordered MySQL ALTER TABLE statements for all operations in a blueprint definition.
Compiles a DROP TABLE statement with optional MySQL existence protection.
Compiles a MySQL table rename while applying configured prefixes to both names.
Compiles a MySQL ALTER TABLE clause that adds a column.
Compiles a MySQL ALTER TABLE clause that modifies or renames a column.
Compiles a MySQL ALTER TABLE clause that drops a column.
Compiles a MySQL ALTER TABLE clause that adds an index.
Compiles a MySQL ALTER TABLE clause that drops an index.
Compiles a MySQL ALTER TABLE clause that adds a foreign-key constraint.
Compiles a MySQL ALTER TABLE clause that drops a foreign-key constraint.
Details
__construct
__construct(MysqlSqlEscaper $escaper, DatabaseConfig $config)
Creates a grammar with the configured table prefix and SQL value escaper.
compileCreateDatabase
string
compileCreateDatabase(string $database)
Compiles MySQL database creation with a validated database identifier.
compileDropDatabase
string
compileDropDatabase(string $database)
Compiles MySQL database removal with a validated database identifier.
compileCreateTable
string
compileCreateTable(TableDefinition $table)
Compiles the primary CREATE TABLE statement for one immutable table definition.
compileCreateTableStatements
array
compileCreateTableStatements(TableDefinition $table)
Compiles every statement required to create a table and its deferred constraints.
compileAlterTable
array
compileAlterTable(TableDefinition $table)
Compiles ordered MySQL ALTER TABLE statements for all operations in a blueprint definition.
compileDropTable
string
compileDropTable(string $table, bool $ifExists = false)
Compiles a DROP TABLE statement with optional MySQL existence protection.
compileRenameTable
string
compileRenameTable(string $from, string $to)
Compiles a MySQL table rename while applying configured prefixes to both names.
compileAddColumn
string
compileAddColumn(string $table, ColumnDefinition $column)
Compiles a MySQL ALTER TABLE clause that adds a column.
compileModifyColumn
string
compileModifyColumn(string $table, ColumnDefinition $column)
Compiles a MySQL ALTER TABLE clause that modifies or renames a column.
compileDropColumn
string
compileDropColumn(string $table, string $column)
Compiles a MySQL ALTER TABLE clause that drops a column.
compileAddIndex
string
compileAddIndex(string $table, IndexDefinition $index)
Compiles a MySQL ALTER TABLE clause that adds an index.
compileDropIndex
string
compileDropIndex(string $table, string $index)
Compiles a MySQL ALTER TABLE clause that drops an index.
compileAddForeignKey
string
compileAddForeignKey(string $table, ForeignKeyDefinition $foreignKey)
Compiles a MySQL ALTER TABLE clause that adds a foreign-key constraint.
compileDropForeignKey
string
compileDropForeignKey(string $table, string $foreignKey)
Compiles a MySQL ALTER TABLE clause that drops a foreign-key constraint.