The "SchemaGrammar" is a layer which helps in compiling valid data definition language (DDL) statements in to create, alter, or destroy the various tables, columns, and metadata in our database schema. These functions are combined with dialect specific "SchemaGrammar" functions to keep the interface database agnostic.
The toSql on the "schema" is different than that on the "builder", it produces an array of sql statements to be used in the creation or modification of the query, which are each run in sequence on the same connection.
Clone the builder, before we go about working with the columns & commands. TODO: Clean this up.
Add the commands that are implied by the blueprint.
Add an "additional" command, for any extra dialect-specific logic.
Add indicies
If the index has been specified on the given column, but is simply equal to "true" (boolean), no name has been specified for this index, so we will simply call the index methods without one.
If the index has been specified on the column and it is something other than boolean true, we will assume a name was provided on the index specification, and pass in the name to the method.
Each type of command has a corresponding compiler function on the schema grammar which is used to build the necessary SQL statements to build the blueprint element, so we'll just call that compilers function.
Compile a foreign key command.
Once we have the basic foreign key creation statement constructed we can build out the syntax for what should happen on an update or delete of the affected columns, which will get something like "cascade", etc.
Each of the column types have their own compiler functions which are responsible for turning the column definition into its SQL format for the platform. Then column modifiers are compiled and added.
Add the column modifiers to the definition.
Get the SQL for the column data type.
Add a prefix to an array of values, utilized in the client libs.
Wrap a table in keyword identifiers.
Wrap a value in keyword identifiers.
Format a value so that it can be used in "default" clauses.
Get the primary key command if it exists on the blueprint.
Get all of the commands with a given name.
Used to compile any database specific items.
Compile a create table command.
Compile a drop table command.
Compile a drop table (if exists) command.
Compile a drop index command.
Default for a biginteger type in database in other databases.
Create the column definition for a string type.
Create the column definition for a text type.
Create the column definition for a tiny integer type.
Create the column definition for a time type.
Create the column definition for a date type.
Create the column definition for a binary type.
Create the column definition for a json type.
Create the column definition for a uuid type.
Create a specific type
Get the SQL for a nullable column modifier.
Get the SQL for a default column modifier.
SchemaGrammar