Skip to main content

Module schema

Module schema 

Source
Expand description

Schema builder. Used in migrations: Schema::create("users", |t| ...).

Mirrors Laravel’s Schema::create ergonomics + the full Blueprint column type surface: t.string("name").not_null().unique(), t.decimal("price", 10, 2), t.morphs("commentable"), t.remember_token(), foreign-key constraint builders, etc.

§Dialects

Schema::new() defaults to Postgres. For MySQL / SQLite, use Schema::for_driver(Driver::*). The MigrationRunner calls Schema::for_driver(pool.driver()) automatically so user code rarely needs to think about it.

Structs§

ColumnDef
ForeignKeyBuilder
Fluent builder returned by Table::foreign(col). Drop it (or call .constrain()) to commit the foreign key SQL.
Schema
Table
A table definition assembled inside the build closure.