Methods |
public
|
__construct(string $table, Closure|null $callback = null, string $prefix = ''): void
Create a new schema blueprint.
Create a new schema blueprint.
|
#
|
public
|
build(Connection $connection, Grammar $grammar): void
Execute the blueprint against the database.
Execute the blueprint against the database.
|
#
|
public
|
toSql(Connection $connection, Grammar $grammar): array
Get the raw SQL statements for the blueprint.
Get the raw SQL statements for the blueprint.
|
#
|
public
|
addFluentCommands(Grammar $grammar): void
Add the fluent commands specified on any columns.
Add the fluent commands specified on any columns.
|
#
|
public
|
creating(): bool
Determine if the blueprint has a create command.
Determine if the blueprint has a create command.
|
#
|
public
|
create(): Fluent
Indicate that the table needs to be created.
Indicate that the table needs to be created.
|
#
|
public
|
temporary(): void
Indicate that the table needs to be temporary.
Indicate that the table needs to be temporary.
|
#
|
public
|
drop(): Fluent
Indicate that the table should be dropped.
Indicate that the table should be dropped.
|
#
|
public
|
dropIfExists(): Fluent
Indicate that the table should be dropped if it exists.
Indicate that the table should be dropped if it exists.
|
#
|
public
|
dropColumn(array|mixed $columns): Fluent
Indicate that the given columns should be dropped.
Indicate that the given columns should be dropped.
|
#
|
public
|
renameColumn(string $from, string $to): Fluent
Indicate that the given columns should be renamed.
Indicate that the given columns should be renamed.
|
#
|
public
|
dropPrimary(string|array|null $index = null): Fluent
Indicate that the given primary key should be dropped.
Indicate that the given primary key should be dropped.
|
#
|
public
|
dropUnique(string|array $index): Fluent
Indicate that the given unique key should be dropped.
Indicate that the given unique key should be dropped.
|
#
|
public
|
dropIndex(string|array $index): Fluent
Indicate that the given index should be dropped.
Indicate that the given index should be dropped.
|
#
|
public
|
dropFullText(string|array $index): Fluent
Indicate that the given fulltext index should be dropped.
Indicate that the given fulltext index should be dropped.
|
#
|
public
|
dropSpatialIndex(string|array $index): Fluent
Indicate that the given spatial index should be dropped.
Indicate that the given spatial index should be dropped.
|
#
|
public
|
dropForeign(string|array $index): Fluent
Indicate that the given foreign key should be dropped.
Indicate that the given foreign key should be dropped.
|
#
|
public
|
dropConstrainedForeignId(string $column): Fluent
Indicate that the given column and foreign key should be dropped.
Indicate that the given column and foreign key should be dropped.
|
#
|
public
|
renameIndex(string $from, string $to): Fluent
Indicate that the given indexes should be renamed.
Indicate that the given indexes should be renamed.
|
#
|
public
|
dropTimestamps(): void
Indicate that the timestamp columns should be dropped.
Indicate that the timestamp columns should be dropped.
|
#
|
public
|
dropTimestampsTz(): void
Indicate that the timestamp columns should be dropped.
Indicate that the timestamp columns should be dropped.
|
#
|
public
|
dropSoftDeletes(string $column = 'deleted_at'): void
Indicate that the soft delete column should be dropped.
Indicate that the soft delete column should be dropped.
|
#
|
public
|
dropSoftDeletesTz(string $column = 'deleted_at'): void
Indicate that the soft delete column should be dropped.
Indicate that the soft delete column should be dropped.
|
#
|
public
|
dropRememberToken(): void
Indicate that the remember token column should be dropped.
Indicate that the remember token column should be dropped.
|
#
|
public
|
dropMorphs(string $name, string|null $indexName = null): void
Indicate that the polymorphic columns should be dropped.
Indicate that the polymorphic columns should be dropped.
|
#
|
public
|
rename(string $to): Fluent
Rename the table to a given name.
Rename the table to a given name.
|
#
|
public
|
primary(string|array $columns, string|null $name = null, string|null $algorithm = null): Fluent
Specify the primary key(s) for the table.
Specify the primary key(s) for the table.
|
#
|
public
|
unique(string|array $columns, string|null $name = null, string|null $algorithm = null): Fluent
Specify a unique index for the table.
Specify a unique index for the table.
|
#
|
public
|
index(string|array $columns, string|null $name = null, string|null $algorithm = null): Fluent
Specify an index for the table.
Specify an index for the table.
|
#
|
public
|
fullText(string|array $columns, string|null $name = null, string|null $algorithm = null): Fluent
Specify an fulltext for the table.
Specify an fulltext for the table.
|
#
|
public
|
spatialIndex(string|array $columns, string|null $name = null): Fluent
Specify a spatial index for the table.
Specify a spatial index for the table.
|
#
|
public
|
rawIndex(string $expression, string $name): Fluent
Specify a raw index for the table.
Specify a raw index for the table.
|
#
|
public
|
foreign(string|array $columns, string|null $name = null): ForeignKeyDefinition
Specify a foreign key for the table.
Specify a foreign key for the table.
|
#
|
public
|
id(string $column = 'id'): ColumnDefinition
Create a new auto-incrementing big integer (8-byte) column on the table.
Create a new auto-incrementing big integer (8-byte) column on the table.
|
#
|
public
|
increments(string $column): ColumnDefinition
Create a new auto-incrementing integer (4-byte) column on the table.
Create a new auto-incrementing integer (4-byte) column on the table.
|
#
|
public
|
integerIncrements(string $column): ColumnDefinition
Create a new auto-incrementing integer (4-byte) column on the table.
Create a new auto-incrementing integer (4-byte) column on the table.
|
#
|
public
|
tinyIncrements(string $column): ColumnDefinition
Create a new auto-incrementing tiny integer (1-byte) column on the table.
Create a new auto-incrementing tiny integer (1-byte) column on the table.
|
#
|
public
|
smallIncrements(string $column): ColumnDefinition
Create a new auto-incrementing small integer (2-byte) column on the table.
Create a new auto-incrementing small integer (2-byte) column on the table.
|
#
|
public
|
mediumIncrements(string $column): ColumnDefinition
Create a new auto-incrementing medium integer (3-byte) column on the table.
Create a new auto-incrementing medium integer (3-byte) column on the table.
|
#
|
public
|
bigIncrements(string $column): ColumnDefinition
Create a new auto-incrementing big integer (8-byte) column on the table.
Create a new auto-incrementing big integer (8-byte) column on the table.
|
#
|
public
|
char(string $column, int|null $length = null): ColumnDefinition
Create a new char column on the table.
Create a new char column on the table.
|
#
|
public
|
string(string $column, int|null $length = null): ColumnDefinition
Create a new string column on the table.
Create a new string column on the table.
|
#
|
public
|
tinyText(string $column): ColumnDefinition
Create a new tiny text column on the table.
Create a new tiny text column on the table.
|
#
|
public
|
text(string $column): ColumnDefinition
Create a new text column on the table.
Create a new text column on the table.
|
#
|
public
|
mediumText(string $column): ColumnDefinition
Create a new medium text column on the table.
Create a new medium text column on the table.
|
#
|
public
|
longText(string $column): ColumnDefinition
Create a new long text column on the table.
Create a new long text column on the table.
|
#
|
public
|
integer(string $column, bool $autoIncrement = false, bool $unsigned = false): ColumnDefinition
Create a new integer (4-byte) column on the table.
Create a new integer (4-byte) column on the table.
|
#
|
public
|
tinyInteger(string $column, bool $autoIncrement = false, bool $unsigned = false): ColumnDefinition
Create a new tiny integer (1-byte) column on the table.
Create a new tiny integer (1-byte) column on the table.
|
#
|
public
|
smallInteger(string $column, bool $autoIncrement = false, bool $unsigned = false): ColumnDefinition
Create a new small integer (2-byte) column on the table.
Create a new small integer (2-byte) column on the table.
|
#
|
public
|
mediumInteger(string $column, bool $autoIncrement = false, bool $unsigned = false): ColumnDefinition
Create a new medium integer (3-byte) column on the table.
Create a new medium integer (3-byte) column on the table.
|
#
|
public
|
bigInteger(string $column, bool $autoIncrement = false, bool $unsigned = false): ColumnDefinition
Create a new big integer (8-byte) column on the table.
Create a new big integer (8-byte) column on the table.
|
#
|
public
|
unsignedInteger(string $column, bool $autoIncrement = false): ColumnDefinition
Create a new unsigned integer (4-byte) column on the table.
Create a new unsigned integer (4-byte) column on the table.
|
#
|
public
|
unsignedTinyInteger(string $column, bool $autoIncrement = false): ColumnDefinition
Create a new unsigned tiny integer (1-byte) column on the table.
Create a new unsigned tiny integer (1-byte) column on the table.
|
#
|
public
|
unsignedSmallInteger(string $column, bool $autoIncrement = false): ColumnDefinition
Create a new unsigned small integer (2-byte) column on the table.
Create a new unsigned small integer (2-byte) column on the table.
|
#
|
public
|
unsignedMediumInteger(string $column, bool $autoIncrement = false): ColumnDefinition
Create a new unsigned medium integer (3-byte) column on the table.
Create a new unsigned medium integer (3-byte) column on the table.
|
#
|
public
|
unsignedBigInteger(string $column, bool $autoIncrement = false): ColumnDefinition
Create a new unsigned big integer (8-byte) column on the table.
Create a new unsigned big integer (8-byte) column on the table.
|
#
|
public
|
foreignId(string $column): ForeignIdColumnDefinition
Create a new unsigned big integer (8-byte) column on the table.
Create a new unsigned big integer (8-byte) column on the table.
|
#
|
public
|
foreignIdFor(Model|string $model, string|null $column = null): ForeignIdColumnDefinition
Create a foreign ID column for the given model.
Create a foreign ID column for the given model.
|
#
|
public
|
float(string $column, int $total = 8, int $places = 2, bool $unsigned = false): ColumnDefinition
Create a new float column on the table.
Create a new float column on the table.
|
#
|
public
|
double(string $column, int|null $total = null, int|null $places = null, bool $unsigned = false): ColumnDefinition
Create a new double column on the table.
Create a new double column on the table.
|
#
|
public
|
decimal(string $column, int $total = 8, int $places = 2, bool $unsigned = false): ColumnDefinition
Create a new decimal column on the table.
Create a new decimal column on the table.
|
#
|
public
|
unsignedFloat(string $column, int $total = 8, int $places = 2): ColumnDefinition
Create a new unsigned float column on the table.
Create a new unsigned float column on the table.
|
#
|
public
|
unsignedDouble(string $column, int $total = null, int $places = null): ColumnDefinition
Create a new unsigned double column on the table.
Create a new unsigned double column on the table.
|
#
|
public
|
unsignedDecimal(string $column, int $total = 8, int $places = 2): ColumnDefinition
Create a new unsigned decimal column on the table.
Create a new unsigned decimal column on the table.
|
#
|
public
|
boolean(string $column): ColumnDefinition
Create a new boolean column on the table.
Create a new boolean column on the table.
|
#
|
public
|
enum(string $column, array $allowed): ColumnDefinition
Create a new enum column on the table.
Create a new enum column on the table.
|
#
|
public
|
set(string $column, array $allowed): ColumnDefinition
Create a new set column on the table.
Create a new set column on the table.
|
#
|
public
|
json(string $column): ColumnDefinition
Create a new json column on the table.
Create a new json column on the table.
|
#
|
public
|
jsonb(string $column): ColumnDefinition
Create a new jsonb column on the table.
Create a new jsonb column on the table.
|
#
|
public
|
date(string $column): ColumnDefinition
Create a new date column on the table.
Create a new date column on the table.
|
#
|
public
|
dateTime(string $column, int $precision = 0): ColumnDefinition
Create a new date-time column on the table.
Create a new date-time column on the table.
|
#
|
public
|
dateTimeTz(string $column, int $precision = 0): ColumnDefinition
Create a new date-time column (with time zone) on the table.
Create a new date-time column (with time zone) on the table.
|
#
|
public
|
time(string $column, int $precision = 0): ColumnDefinition
Create a new time column on the table.
Create a new time column on the table.
|
#
|
public
|
timeTz(string $column, int $precision = 0): ColumnDefinition
Create a new time column (with time zone) on the table.
Create a new time column (with time zone) on the table.
|
#
|
public
|
timestamp(string $column, int $precision = 0): ColumnDefinition
Create a new timestamp column on the table.
Create a new timestamp column on the table.
|
#
|
public
|
timestampTz(string $column, int $precision = 0): ColumnDefinition
Create a new timestamp (with time zone) column on the table.
Create a new timestamp (with time zone) column on the table.
|
#
|
public
|
timestamps(int $precision = 0): void
Add nullable creation and update timestamps to the table.
Add nullable creation and update timestamps to the table.
|
#
|
public
|
nullableTimestamps(int $precision = 0): void
Add nullable creation and update timestamps to the table.
Add nullable creation and update timestamps to the table.
Alias for self::timestamps().
|
#
|
public
|
timestampsTz(int $precision = 0): void
Add creation and update timestampTz columns to the table.
Add creation and update timestampTz columns to the table.
|
#
|
public
|
softDeletes(string $column = 'deleted_at', int $precision = 0): ColumnDefinition
Add a "deleted at" timestamp for the table.
Add a "deleted at" timestamp for the table.
|
#
|
public
|
softDeletesTz(string $column = 'deleted_at', int $precision = 0): ColumnDefinition
Add a "deleted at" timestampTz for the table.
Add a "deleted at" timestampTz for the table.
|
#
|
public
|
year(string $column): ColumnDefinition
Create a new year column on the table.
Create a new year column on the table.
|
#
|
public
|
binary(string $column): ColumnDefinition
Create a new binary column on the table.
Create a new binary column on the table.
|
#
|
public
|
uuid(string $column): ColumnDefinition
Create a new uuid column on the table.
Create a new uuid column on the table.
|
#
|
public
|
foreignUuid(string $column): ForeignIdColumnDefinition
Create a new UUID column on the table with a foreign key constraint.
Create a new UUID column on the table with a foreign key constraint.
|
#
|
public
|
ipAddress(string $column): ColumnDefinition
Create a new IP address column on the table.
Create a new IP address column on the table.
|
#
|
public
|
macAddress(string $column): ColumnDefinition
Create a new MAC address column on the table.
Create a new MAC address column on the table.
|
#
|
public
|
geometry(string $column): ColumnDefinition
Create a new geometry column on the table.
Create a new geometry column on the table.
|
#
|
public
|
point(string $column, int|null $srid = null): ColumnDefinition
Create a new point column on the table.
Create a new point column on the table.
|
#
|
public
|
lineString(string $column): ColumnDefinition
Create a new linestring column on the table.
Create a new linestring column on the table.
|
#
|
public
|
polygon(string $column): ColumnDefinition
Create a new polygon column on the table.
Create a new polygon column on the table.
|
#
|
public
|
geometryCollection(string $column): ColumnDefinition
Create a new geometrycollection column on the table.
Create a new geometrycollection column on the table.
|
#
|
public
|
multiPoint(string $column): ColumnDefinition
Create a new multipoint column on the table.
Create a new multipoint column on the table.
|
#
|
public
|
multiLineString(string $column): ColumnDefinition
Create a new multilinestring column on the table.
Create a new multilinestring column on the table.
|
#
|
public
|
multiPolygon(string $column): ColumnDefinition
Create a new multipolygon column on the table.
Create a new multipolygon column on the table.
|
#
|
public
|
multiPolygonZ(string $column): ColumnDefinition
Create a new multipolygon column on the table.
Create a new multipolygon column on the table.
|
#
|
public
|
computed(string $column, string $expression): ColumnDefinition
Create a new generated, computed column on the table.
Create a new generated, computed column on the table.
|
#
|
public
|
morphs(string $name, string|null $indexName = null): void
Add the proper columns for a polymorphic table.
Add the proper columns for a polymorphic table.
|
#
|
public
|
nullableMorphs(string $name, string|null $indexName = null): void
Add nullable columns for a polymorphic table.
Add nullable columns for a polymorphic table.
|
#
|
public
|
numericMorphs(string $name, string|null $indexName = null): void
Add the proper columns for a polymorphic table using numeric IDs (incremental).
Add the proper columns for a polymorphic table using numeric IDs (incremental).
|
#
|
public
|
nullableNumericMorphs(string $name, string|null $indexName = null): void
Add nullable columns for a polymorphic table using numeric IDs (incremental).
Add nullable columns for a polymorphic table using numeric IDs (incremental).
|
#
|
public
|
uuidMorphs(string $name, string|null $indexName = null): void
Add the proper columns for a polymorphic table using UUIDs.
Add the proper columns for a polymorphic table using UUIDs.
|
#
|
public
|
nullableUuidMorphs(string $name, string|null $indexName = null): void
Add nullable columns for a polymorphic table using UUIDs.
Add nullable columns for a polymorphic table using UUIDs.
|
#
|
public
|
rememberToken(): ColumnDefinition
Adds the `remember_token` column to the table.
Adds the remember_token column to the table.
|
#
|
public
|
addColumn(string $type, string $name, array $parameters = []): ColumnDefinition
Add a new column to the blueprint.
Add a new column to the blueprint.
|
#
|
public
|
after(string $column, Closure $callback): void
Add the columns from the callback after the given column.
Add the columns from the callback after the given column.
|
#
|
public
|
removeColumn(string $name): $this
Remove a column from the schema blueprint.
Remove a column from the schema blueprint.
|
#
|
public
|
getTable(): string
Get the table the blueprint describes.
Get the table the blueprint describes.
|
#
|
public
|
getColumns(): ColumnDefinition[]
Get the columns on the blueprint.
Get the columns on the blueprint.
|
#
|
public
|
getCommands(): Fluent[]
Get the commands on the blueprint.
Get the commands on the blueprint.
|
#
|
public
|
getAddedColumns(): ColumnDefinition[]
Get the columns on the blueprint that should be added.
Get the columns on the blueprint that should be added.
|
#
|
public
|
getChangedColumns(): ColumnDefinition[]
Get the columns on the blueprint that should be changed.
Get the columns on the blueprint that should be changed.
|
#
|
public
|
hasAutoIncrementColumn(): bool
Determine if the blueprint has auto-increment columns.
Determine if the blueprint has auto-increment columns.
|
#
|
public
|
autoIncrementingStartingValues(): array
Get the auto-increment column starting values.
Get the auto-increment column starting values.
|
#
|