When creating a column from the Blueprint object, a Column object is returned. This column gives you access to a few modifier commands to further configure the column.
comment
Attach a comment to the column.
Example:
SchemaBuilder
schema.create( "users",function( table ) {table.integer( "age" ).comment( "Do not lie about your age" );} );
SQL (MySQL)
CREATETABLE `users` (`age`INTEGERNOT NULL COMMENT `Do not lie about your age`)
default
Sets a default value for the column.
Note: The value is not escaped, allowing you to specify functions like NOW() or literals like 1. To specify a literal string, wrap the value in quotes.
Creates a stored computed column. Computed columns are defined as expressions between other columns and/or constant values. Stored computed columns are saved in the database to avoid computing on every query.
Your database grammar may not differentiate between stored computed columns and virtual computed columns. Research your grammar's implementation for more details.
CREATETABLE "PRODUCTS" ("PRICE"NUMBER(10, 0) NOT NULL,"TAX"NUMBER(10, 0) GENERATEDALWAYSAS (price *0.0675))
virtualAs
Creates a virtual computed column. Computed columns are defined as expressions between other columns and/or constant values. Virtual computed columns are computed on every query.
Your database grammar may not differentiate between stored computed columns and virtual computed columns. Research your grammar's implementation for more details.