class SchemaConnection

internal  
 

The schema facts of the connection that migrations run on, which its pooled and routed connections share.

A table missing from an incomplete connection is unknown rather than absent.

Properties

SchemaTable> $tables
array<string, null|Domain|EnumType> $types
bool $complete

Whether every relation is known, so that a missing table is a claim.

list<array{path: string, line: int, message: string}> $unusableDumps

Methods

__construct(string $name, string $driver)

Create a new schema connection instance.

void
__clone()

Copy the tables, so that each branch of a migration changes its own copy.

string
key(string|null $schema, string $name)

Get the identity key of a schema-qualified name, which ignores ASCII case where SQLite does.

false|string|null
findTableKey(string|null $schema, string $name, string|null $defaultSchema, array $searchPath)

Find the identity key of a relation, or return null when it is absent and false when it is ambiguous.

void
addTable(Table $definition, ConnectionConfig $connection, bool $complete)

Add a parsed table, linking the known relations it inherits from or partitions.

array
caseVariants(string|null $schema, string $name)

Get the identity keys of other relations whose schema and name differ only in letter case.

void
forgetTable(string|null $schema, string $name)

Make a relation and its known inheritance and partition descendants unknown.

void
forgetDescendants(string $key)

Make the known inheritance and partition descendants of a relation unknown.

void
dropTable(string $key)

Remove a relation that no longer exists, making its descendants unknown.

void
forgetType(string|null $schema, string $name, array $searchPath)

Make a user type uncertain after a script altered or dropped it.

void
forget()

Make every fact unknown.

Details

at line 43
__construct(string $name, string $driver)

Create a new schema connection instance.

Parameters

string $name
string $driver

at line 50
void __clone()

Copy the tables, so that each branch of a migration changes its own copy.

Return Value

void

at line 60
string key(string|null $schema, string $name)

Get the identity key of a schema-qualified name, which ignores ASCII case where SQLite does.

Parameters

string|null $schema
string $name

Return Value

string

at line 79
false|string|null findTableKey(string|null $schema, string $name, string|null $defaultSchema, array $searchPath)

Find the identity key of a relation, or return null when it is absent and false when it is ambiguous.

Unqualified MySQL and SQLite names use the connection's default schema. An unqualified PostgreSQL name resolves through the search path. An unqualified definition was created in the first existing schema of its connection's path, so it only matches the same path when no qualified candidate exists.

Parameters

string|null $schema
string $name
string|null $defaultSchema
array $searchPath

Return Value

false|string|null

at line 116
void addTable(Table $definition, ConnectionConfig $connection, bool $complete)

Add a parsed table, linking the known relations it inherits from or partitions.

Parameters

Table $definition
ConnectionConfig $connection
bool $complete

whether the input it comes from is free of schema-level issues

Return Value

void

at line 145
array caseVariants(string|null $schema, string $name)

Get the identity keys of other relations whose schema and name differ only in letter case.

MySQL compares database and table names without case on some servers, so a change to one spelling can change another. Identities stay exact, since other servers keep them distinct.

Parameters

string|null $schema
string $name

Return Value

array

at line 170
void forgetTable(string|null $schema, string $name)

Make a relation and its known inheritance and partition descendants unknown.

The relation may no longer exist or have its earlier columns. PostgreSQL applies ALTER TABLE without ONLY, and the drop of a partitioned table, to descendants too.

Parameters

string|null $schema
string $name

Return Value

void

at line 183
void forgetDescendants(string $key)

Make the known inheritance and partition descendants of a relation unknown.

Parameters

string $key

Return Value

void

at line 201
void dropTable(string $key)

Remove a relation that no longer exists, making its descendants unknown.

Parameters

string $key

Return Value

void

at line 218
void forgetType(string|null $schema, string $name, array $searchPath)

Make a user type uncertain after a script altered or dropped it.

A qualified name is marked even when nothing recorded it, which stops any search along a path through its schema, so a definition recorded without a schema stays known: it was created in a path schema. An unqualified name can denote any recorded definition along the search path.

Parameters

string|null $schema
string $name
array $searchPath

Return Value

void

at line 238
void forget()

Make every fact unknown.

Return Value

void