Nextcloud PHP API (master)

ITable

Object representation of a table.

Tags
since
35.0.0
Attributes
#[Consumable]
$since: '35.0.0'

Table of Contents

Methods

addColumn()  : IColumn
addForeignKeyConstraint()  : self
Adds a foreign key constraint.
addIndex()  : self
addUniqueConstraint()  : self
addUniqueIndex()  : self
dropColumn()  : self
Drops a Column from the Table.
dropIndex()  : self
Drops an index from this table.
dropPrimaryKey()  : self
Drops the primary key from this table.
getColumn()  : IColumn
Returns the Column with the given name.
getColumns()  : array<int, IColumn>
Returns all columns of this table.
getForeignKeys()  : array<int, IForeignKeyConstraint>
getIndex()  : IIndex
Returns a specific index by name of this table.
getIndexes()  : array<int, IIndex>
Returns all indexes of this table.
getName()  : non-empty-string
Returns the name of this table.
getPrimaryKey()  : IIndex|null
Returns the primary key, or null if this table has no primary key.
hasColumn()  : bool
Returns whether this table has a Column with the given name.
hasForeignKey()  : bool
Returns whether this table has a foreign key constraint with the given name.
hasIndex()  : bool
Returns whether this table has an index with the given name.
hasPrimaryKey()  : bool
Returns whether this table has a primary key.
hasUniqueConstraint()  : bool
Returns whether this table has a unique constraint with the given name.
modifyColumn()  : self
removeForeignKey()  : void
Removes the foreign key constraint with the given name.
removeUniqueConstraint()  : void
Removes the unique constraint with the given name.
renameIndex()  : self
Renames an index.
setPrimaryKey()  : self
Sets the Primary Key.

Methods

addColumn()

public addColumn(non-empty-string $name, Types::*|ColumnType $typeName[, ColumnType, comment?: string} $options = [] ]) : IColumn
Parameters
$name : non-empty-string
$typeName : Types::*|ColumnType
$options : ColumnType, comment?: string} = []
Tags
throws
SchemaException
since
35.0.0
Return values
IColumn

addForeignKeyConstraint()

Adds a foreign key constraint.

public addForeignKeyConstraint(ITable|non-empty-string $foreignTable, array<int, non-empty-string> $localColumnNames, array<int, non-empty-string> $foreignColumnNames[, array<string, mixed> $options = [] ][, string|null $name = null ]) : self

Name is inferred from the local columns.

Parameters
$foreignTable : ITable|non-empty-string

Table schema instance or table name

$localColumnNames : array<int, non-empty-string>
$foreignColumnNames : array<int, non-empty-string>
$options : array<string, mixed> = []
$name : string|null = null
Tags
throws
SchemaException
since
35.0.0
Return values
self

addIndex()

public addIndex(array<int, non-empty-string> $columnNames[, non-empty-string|null $indexName = null ][, array<int, non-empty-string> $flags = [] ][, array<non-empty-string, mixed> $options = [] ]) : self
Parameters
$columnNames : array<int, non-empty-string>
$indexName : non-empty-string|null = null
$flags : array<int, non-empty-string> = []
$options : array<non-empty-string, mixed> = []
Tags
throws
SchemaException
since
35.0.0
Return values
self

addUniqueConstraint()

public addUniqueConstraint(array<int, string> $columnNames[, string|null $indexName = null ][, array<int, string> $flags = [] ][, array<string, mixed> $options = [] ]) : self
Parameters
$columnNames : array<int, string>
$indexName : string|null = null
$flags : array<int, string> = []
$options : array<string, mixed> = []
Tags
since
35.0.0
Return values
self

addUniqueIndex()

public addUniqueIndex(array<int, string> $columnNames[, non-empty-string|null $indexName = null ][, array<string, mixed> $options = [] ]) : self
Parameters
$columnNames : array<int, string>
$indexName : non-empty-string|null = null
$options : array<string, mixed> = []
Tags
throws
SchemaException
since
35.0.0
Return values
self

dropColumn()

Drops a Column from the Table.

public dropColumn(non-empty-string $name) : self
Parameters
$name : non-empty-string
Tags
since
35.0.0
Return values
self

dropIndex()

Drops an index from this table.

public dropIndex(non-empty-string $name) : self
Parameters
$name : non-empty-string

The index name.

Tags
throws
SchemaException

If the index does not exist.

since
35.0.0
Return values
self

dropPrimaryKey()

Drops the primary key from this table.

public dropPrimaryKey() : self
Tags
throws
SchemaException
since
35.0.0
Return values
self

getColumn()

Returns the Column with the given name.

public getColumn(non-empty-string $name) : IColumn
Parameters
$name : non-empty-string

The column name.

Tags
throws
SchemaException

If the column does not exist.

since
35.0.0
Return values
IColumn

getColumns()

Returns all columns of this table.

public getColumns() : array<int, IColumn>
Tags
since
35.0.0
Return values
array<int, IColumn>

getIndex()

Returns a specific index by name of this table.

public getIndex(non-empty-string $name) : IIndex
Parameters
$name : non-empty-string

The index name.

Tags
since
35.0.0
Return values
IIndex

getIndexes()

Returns all indexes of this table.

public getIndexes() : array<int, IIndex>
Tags
since
35.0.0
Return values
array<int, IIndex>

getName()

Returns the name of this table.

public getName() : non-empty-string
Tags
since
35.0.0
Return values
non-empty-string

getPrimaryKey()

Returns the primary key, or null if this table has no primary key.

public getPrimaryKey() : IIndex|null
Tags
since
35.0.0
Return values
IIndex|null

hasColumn()

Returns whether this table has a Column with the given name.

public hasColumn(non-empty-string $name) : bool
Parameters
$name : non-empty-string

The column name.

Tags
since
35.0.0
Return values
bool

hasForeignKey()

Returns whether this table has a foreign key constraint with the given name.

public hasForeignKey(non-empty-string $name) : bool
Parameters
$name : non-empty-string

The foreign key name.

Tags
since
35.0.0
Return values
bool

hasIndex()

Returns whether this table has an index with the given name.

public hasIndex(non-empty-string $name) : bool
Parameters
$name : non-empty-string

The index name.

Tags
since
35.0.0
Return values
bool

hasPrimaryKey()

Returns whether this table has a primary key.

public hasPrimaryKey() : bool
Tags
since
35.0.0
Return values
bool

hasUniqueConstraint()

Returns whether this table has a unique constraint with the given name.

public hasUniqueConstraint(non-empty-string $name) : bool
Parameters
$name : non-empty-string

The unique constraint name.

Tags
since
35.0.0
Return values
bool

modifyColumn()

public modifyColumn(non-empty-string $name, ColumnType, comment?: string} $options) : self
Parameters
$name : non-empty-string
$options : ColumnType, comment?: string}
Tags
throws
SchemaException
since
35.0.0
Return values
self

removeForeignKey()

Removes the foreign key constraint with the given name.

public removeForeignKey(non-empty-string $name) : void
Parameters
$name : non-empty-string

The constraint name.

Tags
throws
SchemaException
since
35.0.0

removeUniqueConstraint()

Removes the unique constraint with the given name.

public removeUniqueConstraint(non-empty-string $name) : void
Parameters
$name : non-empty-string

The unique constraint name.

Tags
throws
SchemaException

If the unique constraint does not exist.

since
35.0.0

renameIndex()

Renames an index.

public renameIndex(non-empty-string $oldName[, non-empty-string|null $newName = null ]) : self
Parameters
$oldName : non-empty-string

The name of the index to rename from.

$newName : non-empty-string|null = null

The name of the index to rename to. If null is given, the index name will be auto-generated.

Tags
throws
SchemaException

If no index exists for the given current name or if an index with the given new name already exists on this table.

since
35.0.0
Return values
self

This table instance.

setPrimaryKey()

Sets the Primary Key.

public setPrimaryKey(array<int, non-empty-string> $columnNames[, non-empty-string|false $indexName = false ]) : self
Parameters
$columnNames : array<int, non-empty-string>
$indexName : non-empty-string|false = false
Tags
throws
SchemaException
since
35.0.0
Return values
self
On this page

Search results