API / Minn\Runtime / DbDelta

DbDelta final readonly class

Minn\Runtime\DbDelta · public/minn/src/Minn/Runtime/DbDelta.php · 125 lines

dbDelta as the reference does it: a CREATE TABLE statement creates the table when it is missing, otherwise the columns and keys the statement has and the table lacks are added. Nothing is ever dropped or altered.

Uses 1

Constants and properties

privatereadonly Minn\Db $db

Promoted from the constructor.

Public

new__construct(Minn\Db $db)#
staticcreates(array $queries): array#

The CREATE TABLE statements in a batch, keyed by table name. @param list<string> $queries @return array<string, string>

$querieslist<string>@return array<string, string>
methodapply(array $creates, bool $execute): array#

Applies CREATE TABLE statements as dbDelta does; the statements run.

$createsarray<string, string>@return array<string, string> what was (or would be) done, by table or table.column
methodtables(): array#

Every table in the database.

@return list<string>
methodcolumns(string $table): array#

A table's columns with their definitions.

@return array<string, array<string, mixed>> by column name
methodindexNames(string $table): array#

A table's index names.

@return list<string> lowercase key names
methodrun(string $ddl): void#

Runs one DDL statement.

Internals 1

Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.

privatedefinitions(string $body): array#
@return array{0: array<string, string>, 1: list<string>} column definitions by lowercase name, and the index lines