class SchemaAggregator

Applies migrations to the schema facts of the connections they run on.

Only constructs whose effect is certain are interpreted; anything else makes the facts it could affect unknown, so that inference never claims a column is missing without proof.

A state is a copy of the facts: the connections, whether an earlier migration could have changed any connection, and the morph key type. A scope holds the migration class, the class declaring the body being applied (null for the migration class itself), the connection its statements default to (null when it is unknown), inside a Blueprint callback the table it changes, with a copy of it as it was before the callback, and the Blueprint's variable, and the local variables holding Schema builders: those whose calls are followed, and those that escape, whose uses make the connections they select unknown.

Constants

private IGNORED_SCHEMA_METHODS

Schema builder methods that change no relations or column types. withoutForeignKeyConstraints() runs a callback that is applied on its own.

private TABLE_SCHEMA_METHODS

Schema builder methods that change one table, by the position and name of their table parameter.

private MORPH_KEY_SCHEMA_METHODS

Schema builder methods that change the key type morphs() adds.

private COLUMN_METHODS

Blueprint methods that add one column, with the Blueprint type they add.

private DEFAULT_COLUMN_NAMES

The column names Blueprint methods use when none is given.

private UNSIGNED_COLUMN_METHODS

Blueprint methods that add an unsigned column.

private SIGNABLE_COLUMN_METHODS

Blueprint methods whose third parameter decides whether the column is unsigned.

private NULLABLE_COLUMN_METHODS

Blueprint methods that add a nullable column.

private FOREIGN_ID_COLUMN_METHODS

Blueprint methods that return a ForeignIdColumnDefinition, whose constrained() and references() return its foreign key.

private IGNORED_BLUEPRINT_METHODS

Blueprint methods that change no columns.

private GRAMMAR_TYPES

The type names each driver's schema grammar creates Blueprint types with, by Blueprint type.

The grammar is not run: MySQL's date and year types read the live server version. Spatial, vector and raw types have no fixed name, so their columns are unknown.

Properties

array<string, true> $sources

Methods

__construct(ReflectionProvider $reflectionProvider, InitializerExprTypeResolver $initializerExprTypeResolver, ConnectionConfigResolver $connectionConfigResolver, Parser $parser, array $connections = [])

Create a new schema aggregator instance.

void
addStatements(array $stmts)

Apply the migration classes a file declares.

void
invalidate()

Make every connection's facts and the morph key type unknown, for migration code that cannot be read.

Details

at line 213
__construct(ReflectionProvider $reflectionProvider, InitializerExprTypeResolver $initializerExprTypeResolver, ConnectionConfigResolver $connectionConfigResolver, Parser $parser, array $connections = [])

Create a new schema aggregator instance.

Parameters

ReflectionProvider $reflectionProvider
InitializerExprTypeResolver $initializerExprTypeResolver
ConnectionConfigResolver $connectionConfigResolver
Parser $parser
array $connections

the schema facts, by owning connection

at line 228
void addStatements(array $stmts)

Apply the migration classes a file declares.

Parameters

array $stmts

Return Value

void

at line 243
void invalidate()

Make every connection's facts and the morph key type unknown, for migration code that cannot be read.

Return Value

void