classSchema
final class Schema
Public API: explicitly declared with
@visibility public.Reads the table state needed to analyze statements against known declarations.
Schema describes state; Semantics describes SQL operations. Statements whose resulting columns require query evaluation remain statement models.
$schema = new \SqlSemantics\Facade\Schema(\SqlSemantics\Platform\Sqlite\Dialect::Sqlite);
$schema->analyze('CREATE TABLE t (id INTEGER)')->tables[0]->name // => 't'Methods§
public function __construct(
Dialect $dialect,
?string $defaultSchema = null,
?string $grammarVersion = null,
)Selects the state declaration language, release and unqualified namespace.
Parameters
$dialect | Dialect | |
$defaultSchema | ?string | |
$grammarVersion | ?string |
Calls 1
public function analyze(string ...$sql): SchemaReads table declarations and DROP TABLE resets into an independent state.
Parameters
$sql | string |
Returns
Throws
SemanticException When catalog facts conflict or cannot be resolvedAnalysisException When declarations are outside the selected languageTest cases 34
SchemaTarget::verifycallsSchemaAnalyzerTest::testAnalyzeLegacyStateUsesVersionedModelscallsColumnPropertiesTest::testAutoIncrementDoesNotInspectDefaultExpressionIdentifierscallsColumnPropertiesTest::testAutoIncrementIsAnExplicitStatePropertycallsColumnPropertiesTest::testCollationKeepsQuotedNamescallsColumnPropertiesTest::testGenerationDoesNotConfuseDefaultCastsWithGeneratedColumnscallsColumnPropertiesTest::testGenerationDoesNotTreatNamedDefaultsAsComputedColumnscallsColumnPropertiesTest::testGenerationKeepsNestedQueryStructureInsideTheColumncallsColumnPropertiesTest::testGenerationPreservesVirtualAndIdentityKindscallsSchemaChangesTest::testDropAppliesInDeclarationOrdercallsSchemaChangesTest::testDropDoesNotRemoveAQualifiedNamesakecallsSchemaChangesTest::testDropHandlesMultipleTargetsAndConditionalCreationcallsSchemaChangesTest::testDropRejectsMissingUnconditionalTargetscallsSchemaChangesTest::testDropRejectsUnresolvedCatalogQualificationcallsTokenGroupsTest::testKeyNamesSeparatesPrefixLengthsAndSortDirectionscallsSchemaRulesTest::testOptionsRetainsStructuredTableChoicescallsColumnDefinitionTest::testWithNullabilityPreservesAllTypedAttributescallsColumnGenerationTest::testComputedGenerationKeepsAnIndependentExpressioncallsColumnGenerationTest::testIdentityKeepsItsOptionsWithoutAComputationcallsInvariantTest::testElementsPreservesImmutableSemanticGraphscallsInvariantTest::testEnsureAcceptsACompleteStatecallsInvariantTest::testMembersPreservesDeclarationOrdercallsInvariantTest::testNamesPreservesCompositeKeyOrdercallsInvariantTest::testTablePreservesAValidCompositeForeignKeycallsSchemaTest::testWithTablesLeavesThePreviousStateIntactcallsSchemaTest::testAnalyzeDistinguishesInvalidSyntaxFromStateConflictscallsSchemaTest::testAnalyzeIsIndependentAcrossCallscallsSchemaTest::testAnalyzePreservesAnExplicitZeroColumnTablecallsSchemaTest::testAnalyzePreservesEmptyQuotedNamescallsSchemaTest::testAnalyzePreservesStatePropertiescallsSchemaTest::testAnalyzeRejectsDuplicateStateIdentitiescallsSchemaTest::testAnalyzeResolvesAnyAffinityFromTableOptionscallsSchemaRulesTest::testOptionsRetainsStructuredTableChoicescallsSchemaRulesTest::testPrimaryNotNullRespectsTableOptionsAndInlineDescendingKeyscalls
Calls 1
- method-call SchemaAnalyzer::analyze() line 41
Private surface 1§
Implementation details, listed for orientation only.
private SchemaAnalyzer $analyzerTest cases 35§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 8
SchemaTest::testWithTablesLeavesThePreviousStateIntactcallsSchemaTest::testAnalyzeDistinguishesInvalidSyntaxFromStateConflictscallsSchemaTest::testAnalyzeIsIndependentAcrossCallscallsSchemaTest::testAnalyzePreservesAnExplicitZeroColumnTablecallsSchemaTest::testAnalyzePreservesEmptyQuotedNamescallsSchemaTest::testAnalyzePreservesStatePropertiescallsSchemaTest::testAnalyzeRejectsDuplicateStateIdentitiescallsSchemaTest::testAnalyzeResolvesAnyAffinityFromTableOptionscalls
Other tests reaching this symbol 27
SchemaTarget::verifycallsSchemaAnalyzerTest::testAnalyzeLegacyStateUsesVersionedModelscallsColumnPropertiesTest::testAutoIncrementDoesNotInspectDefaultExpressionIdentifierscallsColumnPropertiesTest::testAutoIncrementIsAnExplicitStatePropertycallsColumnPropertiesTest::testCollationKeepsQuotedNamescallsColumnPropertiesTest::testGenerationDoesNotConfuseDefaultCastsWithGeneratedColumnscallsColumnPropertiesTest::testGenerationDoesNotTreatNamedDefaultsAsComputedColumnscallsColumnPropertiesTest::testGenerationKeepsNestedQueryStructureInsideTheColumncallsColumnPropertiesTest::testGenerationPreservesVirtualAndIdentityKindscallsSchemaChangesTest::testDropAppliesInDeclarationOrdercallsSchemaChangesTest::testDropDoesNotRemoveAQualifiedNamesakecallsSchemaChangesTest::testDropHandlesMultipleTargetsAndConditionalCreationcallsSchemaChangesTest::testDropRejectsMissingUnconditionalTargetscallsSchemaChangesTest::testDropRejectsUnresolvedCatalogQualificationcallsTokenGroupsTest::testKeyNamesSeparatesPrefixLengthsAndSortDirectionscallsSchemaRulesTest::testOptionsRetainsStructuredTableChoicescallsColumnDefinitionTest::testWithNullabilityPreservesAllTypedAttributescallsColumnGenerationTest::testComputedGenerationKeepsAnIndependentExpressioncallsColumnGenerationTest::testIdentityKeepsItsOptionsWithoutAComputationcallsGenerationKindTestcallsInvariantTest::testElementsPreservesImmutableSemanticGraphscallsInvariantTest::testEnsureAcceptsACompleteStatecallsInvariantTest::testMembersPreservesDeclarationOrdercallsInvariantTest::testNamesPreservesCompositeKeyOrdercallsInvariantTest::testTablePreservesAValidCompositeForeignKeycallsSchemaRulesTest::testOptionsRetainsStructuredTableChoicescallsSchemaRulesTest::testPrimaryNotNullRespectsTableOptionsAndInlineDescendingKeyscalls