| Methods |
public
|
__construct(
string $name,
Column[] $columns = [],
Index[] $indexes = [],
UniqueConstraint[] $uniqueConstraints = [],
ForeignKeyConstraint[] $fkConstraints = [],
mixed[] $options = [],
)
|
#
|
public
|
setSchemaConfig(SchemaConfig $schemaConfig): void
|
#
|
protected
|
_getMaxIdentifierLength(): int
|
#
|
public
|
setPrimaryKey(string[] $columnNames, string|false $indexName = false): self
Sets the Primary Key.
|
#
|
public
|
addIndex(string[] $columnNames, ?string $indexName = null, string[] $flags = [], mixed[] $options = []): self
|
#
|
public
|
addUniqueConstraint(string[] $columnNames, ?string $indexName = null, string[] $flags = [], mixed[] $options = []): self
|
#
|
public
|
dropPrimaryKey(): void
Drops the primary key from this table.
Drops the primary key from this table.
Throws
|
#
|
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.
|
#
|
private
|
_createIndex(
string[] $columnNames,
string $indexName,
bool $isUnique,
bool $isPrimary,
string[] $flags = [],
mixed[] $options = [],
): Index
|
#
|
public
|
addColumn(string $name, string $typeName, mixed[] $options = []): Column
|
#
|
public
|
changeColumn(string $name, mixed[] $options): self
Change Column Details.
Deprecated
Use {@link modifyColumn()} instead.
Throws
|
#
|
public
|
modifyColumn(string $name, mixed[] $options): self
|
#
|
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 $name = 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
|
Throws
|
#
|
public
|
addOption(string $name, mixed $value): self
|
#
|
protected
|
_addColumn(Column $column): void
|
#
|
protected
|
_addIndex(Index $indexCandidate): self
Adds an index to the table.
Adds an index to the table.
Throws
|
#
|
protected
|
_addUniqueConstraint(UniqueConstraint $constraint): self
|
#
|
protected
|
_addForeignKeyConstraint(ForeignKeyConstraint $constraint): 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
|
hasUniqueConstraint(string $name): bool
Returns whether this table has a unique constraint with the given name.
Returns whether this table has a unique constraint with the given name.
|
#
|
public
|
getUniqueConstraint(string $name): UniqueConstraint
Returns the unique constraint with the given name.
Returns the unique constraint with the given name.
Throws
|
#
|
public
|
removeUniqueConstraint(string $name): void
Removes the unique constraint with the given name.
Removes the unique constraint with the given 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
|
getForeignKeyColumns(): Column[]
Returns the foreign key columns
Returns the foreign key columns
Deprecated
Use {@see getForeignKey()} and {@see ForeignKeyConstraint::getLocalColumns()} instead.
|
#
|
private
|
filterColumns(string[] $columnNames, bool $reverse = false): Column[]
Returns only columns that have specified names
Returns only columns that have specified names
|
#
|
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(): Column[]
Returns the primary key columns.
Returns the primary key columns.
Deprecated
Use {@see getPrimaryKey()} and {@see Index::getColumns()} instead.
Throws
|
#
|
public
|
hasPrimaryKey(): bool
Returns whether this table has a primary key.
Returns whether this table has a primary key.
Deprecated
Use {@see getPrimaryKey()} instead.
|
#
|
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
|
getUniqueConstraints(): UniqueConstraint[]
Returns the unique constraints.
Returns the unique constraints.
|
#
|
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.
|
#
|
private
|
_createUniqueConstraint(
string[] $columnNames,
string $indexName,
string[] $flags = [],
mixed[] $options = [],
): UniqueConstraint
|
#
|
private
|
normalizeIdentifier(?string $identifier): string
Normalizes a given identifier.
Normalizes a given identifier.
Trims quotes and lowercases the given identifier.
Returns
The normalized identifier.
|
#
|
public
|
setComment(?string $comment): self
|
#
|
public
|
getComment(): ?string
|
#
|