Methods |
public
|
__construct(
string $name,
Column[] $columns = [],
Index[] $indexes = [],
ForeignKeyConstraint[] $fkConstraints = [],
int $idGeneratorType = 0,
mixed[] $options = [],
)
|
#
|
public
|
setSchemaConfig(SchemaConfig $schemaConfig): void
|
#
|
public
|
setPrimaryKey(string[] $columnNames, string|false $indexName = false): self
Sets the Primary Key.
|
#
|
public
|
addIndex(string[] $columnNames, string|null $indexName = null, string[] $flags = [], mixed[] $options = []): self
|
#
|
public
|
dropPrimaryKey(): void
Drops the primary key from this table.
Drops the primary key from this table.
|
#
|
public
|
dropIndex(string $name): void
Drops an index from this table.
Drops an index from this table.
Parameters
Throws
|
#
|
public
|
addUniqueIndex(string[] $columnNames, string|null $indexName = null, mixed[] $options = []): self
|
#
|
public
|
renameIndex(string $oldName, string|null $newName = null): self
Renames an index.
Parameters
$oldName |
The name of the index to rename from.
|
$newName |
The name of the index to rename to.
If null is given, the index name will be auto-generated.
|
Returns
Throws
|
#
|
public
|
columnsAreIndexed(string[] $columnNames): bool
Checks if an index begins in the order of the given columns.
Checks if an index begins in the order of the given columns.
|
#
|
public
|
addColumn(string $name, string $typeName, mixed[] $options = []): Column
|
#
|
public
|
renameColumn(string $oldName, string $name): void
Renames a Column.
|
#
|
public
|
changeColumn(string $name, mixed[] $options): self
Change Column Details.
|
#
|
public
|
dropColumn(string $name): self
Drops a Column from the Table.
Drops a Column from the Table.
|
#
|
public
|
addForeignKeyConstraint(
Table|string $foreignTable,
string[] $localColumnNames,
string[] $foreignColumnNames,
mixed[] $options = [],
string|null $constraintName = null,
): self
Adds a foreign key constraint.
Adds a foreign key constraint.
Name is inferred from the local columns.
Parameters
$foreignTable |
Table schema instance or table name
|
|
#
|
public
|
addUnnamedForeignKeyConstraint(
Table|string $foreignTable,
string[] $localColumnNames,
string[] $foreignColumnNames,
mixed[] $options = [],
): self
Adds a foreign key constraint.
Adds a foreign key constraint.
Name is to be generated by the database itself.
Deprecated
Use {@link addForeignKeyConstraint}
Parameters
$foreignTable |
Table schema instance or table name
|
|
#
|
public
|
addNamedForeignKeyConstraint(
string $name,
Table|string $foreignTable,
string[] $localColumnNames,
string[] $foreignColumnNames,
mixed[] $options = [],
): self
Adds a foreign key constraint with a given name.
Adds a foreign key constraint with a given name.
Deprecated
Use {@link addForeignKeyConstraint}
Parameters
$foreignTable |
Table schema instance or table name
|
Throws
|
#
|
public
|
addOption(string $name, mixed $value): self
|
#
|
public
|
hasForeignKey(string $name): bool
Returns whether this table has a foreign key constraint with the given name.
Returns whether this table has a foreign key constraint with the given name.
|
#
|
public
|
getForeignKey(string $name): ForeignKeyConstraint
Returns the foreign key constraint with the given name.
Returns the foreign key constraint with the given name.
Parameters
$name |
The constraint name.
|
Throws
|
#
|
public
|
removeForeignKey(string $name): void
Removes the foreign key constraint with the given name.
Removes the foreign key constraint with the given name.
Parameters
$name |
The constraint name.
|
Throws
|
#
|
public
|
getColumns(): Column[]
Returns ordered list of columns (primary keys are first, then foreign keys, then the rest)
Returns ordered list of columns (primary keys are first, then foreign keys, then the rest)
|
#
|
public
|
hasColumn(string $name): bool
Returns whether this table has a Column with the given name.
Returns whether this table has a Column with the given name.
Parameters
|
#
|
public
|
getColumn(string $name): Column
Returns the Column with the given name.
Returns the Column with the given name.
Parameters
Throws
|
#
|
public
|
getPrimaryKey(): Index|null
Returns the primary key.
Returns
The primary key, or null if this Table has no primary key.
|
#
|
public
|
getPrimaryKeyColumns(): string[]
Returns the primary key columns.
Returns the primary key columns.
Throws
|
#
|
public
|
hasPrimaryKey(): bool
Returns whether this table has a primary key.
Returns whether this table has a primary key.
|
#
|
public
|
hasIndex(string $name): bool
Returns whether this table has an Index with the given name.
Returns whether this table has an Index with the given name.
Parameters
|
#
|
public
|
getIndex(string $name): Index
Returns the Index with the given name.
Returns the Index with the given name.
Parameters
Throws
|
#
|
public
|
getIndexes(): Index[]
|
#
|
public
|
getForeignKeys(): ForeignKeyConstraint[]
Returns the foreign key constraints.
Returns the foreign key constraints.
|
#
|
public
|
hasOption(string $name): bool
|
#
|
public
|
getOption(string $name): mixed
|
#
|
public
|
getOptions(): mixed[]
|
#
|
public
|
visit(Visitor $visitor): void
|
#
|
public
|
__clone(): void
Clone of a Table triggers a deep clone of all affected assets.
Clone of a Table triggers a deep clone of all affected assets.
|
#
|
public
|
setComment(?string $comment): self
|
#
|
public
|
getComment(): ?string
|
#
|