Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions lib/private/DB/Schema/Table.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,20 @@ public function addUniqueConstraint(
return $this;
}

#[\Override]
public function hasUniqueConstraint(string $name): bool {
return $this->table->hasUniqueConstraint($name);
}

#[\Override]
public function removeUniqueConstraint(string $name): void {
try {
$this->table->removeUniqueConstraint($name);
} catch (DBALSchemaException $e) {
throw new SchemaException($e->getMessage(), $e->getCode(), $e);
}
}

#[\Override]
public function dropPrimaryKey(): self {
try {
Expand All @@ -101,6 +115,11 @@ public function getPrimaryKey(): ?IIndex {
return $primaryKey !== null ? new Index($primaryKey) : null;
}

#[\Override]
public function hasPrimaryKey(): bool {
return $this->table->hasPrimaryKey();
}

#[\Override]
public function dropIndex(string $name): self {
try {
Expand Down
25 changes: 25 additions & 0 deletions lib/public/DB/Schema/ITable.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,24 @@ public function addUniqueConstraint(
array $options = [],
): self;

/**
* Returns whether this table has a unique constraint with the given name.
*
* @param non-empty-string $name The unique constraint name.
* @since 35.0.0
*/
public function hasUniqueConstraint(string $name): bool;

/**
* Removes the unique constraint with the given name.
*
* @param non-empty-string $name The unique constraint name.
*
* @throws SchemaException If the unique constraint does not exist.
* @since 35.0.0
*/
public function removeUniqueConstraint(string $name): void;

/**
* Drops the primary key from this table.
*
Expand All @@ -77,6 +95,13 @@ public function dropPrimaryKey(): self;
*/
public function getPrimaryKey(): ?IIndex;

/**
* Returns whether this table has a primary key.
*
* @since 35.0.0
*/
public function hasPrimaryKey(): bool;

/**
* Drops an index from this table.
*
Expand Down
Loading