Skip to content

Schema

  • Full name: \Qubus\Expressive\Schema

Properties

connection

protected ?\Qubus\Expressive\Connection $connection

tableList

protected array|null $tableList

currentDatabase

protected ?string $currentDatabase

columns

protected array $columns

Methods

__construct

Constructor.

public __construct(\Qubus\Expressive\Connection $connection): mixed

Parameters:

Parameter Type Description
$connection \Qubus\Expressive\Connection Connection.

getCurrentDatabase

Get the name of the currently used database.

public getCurrentDatabase(): string

Throws:


hasTable

Check if the specified table exists.

public hasTable(string $table, bool $clear = false): bool

Parameters:

Parameter Type Description
$table string Table name.
$clear bool (optional) Refresh table list.

Throws:


getTables

Get a list with all tables that belong to the currently used database.

public getTables(bool $clear = false): string[]

Parameters:

Parameter Type Description
$clear bool (optional) Refresh table list.

Throws:


getColumns

Get a list with all columns that belong to the specified table.

public getColumns(string $table, bool $clear = false, bool $names = true): false|string[]

Parameters:

Parameter Type Description
$table string
$clear bool (optional) Refresh column list.
$names bool (optional) Return only the column names.

Throws:


create

Creates a new table.

public create(string $table, callable $callback): void

Parameters:

Parameter Type Description
$table string Table name.
$callback callable A callback that will define table's fields and indexes.

Throws:


alter

Alters a table's definition.

public alter(string $table, callable $callback): void

Parameters:

Parameter Type Description
$table string Table name
$callback callable A callback that will add or remove fields or indexes.

Throws:


renameTable

Change a table's name.

public renameTable(string $table, string $name): void

Parameters:

Parameter Type Description
$table string The table.
$name string The new name of the table.

Throws:


drop

Deletes a table.

public drop(string $table): void

Parameters:

Parameter Type Description
$table string Table name.

Throws:


truncate

Deletes all records from a table.

public truncate(string $table): void

Parameters:

Parameter Type Description
$table string Table name.

Throws:



Automatically generated on 2025-10-13