Conversation
SchemaBuilderInterface produces a Schema but has no way to apply it, so every caller reimplements the same toSql()-and-execute loop. Two already do: ibexa/test-core's DatabaseSchemaHook, and ibexa/core's LegacySchemaImporter, which additionally drops the schema's tables first so it can run per test case. SchemaApplier covers both, with $dropExistingTables selecting between them.
|
Steveb-p
marked this pull request as ready for review
September 10, 2026 08:17
ibexa-workflow-automation-1
Bot
requested review from
ViniTou,
alongosz,
barw4,
bnowak,
ciastektk,
konradoboza,
mikadamczyk,
tbialcz and
wiewiurdp
and removed request for
a team
September 10, 2026 10:56
Steveb-p
added a commit
to ibexa/test-core
that referenced
this pull request
Sep 10, 2026
…ema#49 Points CI at the branch that adds SchemaApplier, so this PR's tests can run before that PR merges. Must be removed before merging.
bnowak
approved these changes
Sep 11, 2026
mikadamczyk
approved these changes
Sep 15, 2026
Merged
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Related PRs:
IbexaKernelTestTrait::loadSchema()DatabaseSchemaHookDescription:
SchemaBuilderInterfaceproduces aSchemabut has no way of putting it into a database, so everycaller reimplements the same
toSql()-and-execute loop. There are already two, and they differ inone detail:
DatabaseSchemaHook— runs once per suite against a freshly created database,so a plain create is enough.
LegacySchemaImporter— runs per test case fromIbexaKernelTestTrait::loadSchema(),so it drops the schema's tables first (in reverse order, for FKs) and recreates them.
SchemaAppliercovers both, with$dropExistingTablesselecting between them. It lives herebecause this package owns
SchemaBuilder, and because it is the only place both consumers canreach: ibexa/core cannot depend on ibexa/test-core (the dependency runs the other way), and both
already require
ibexa/doctrine-schema— core inrequire, test-core inrequire-dev.Registered as
Ibexa\Contracts\DoctrineSchema\Builder\SchemaApplierInterface, alongside theexisting
SchemaBuilderInterfacealias.Nothing existing changes behaviour — this is purely additive; the two consumers switch over in
their own PRs.
For QA:
composer test— 32 tests / 31 assertions / 4 skipped, unchanged apart from the 4 new ones.PHPStan and code style clean.
The new
SchemaApplierTestcovers the behaviour that matters, against in-memory SQLite: a plainapply creates the tables; applying twice without dropping fails; applying twice with dropping
succeeds and leaves the table empty (proving it really was dropped and recreated, not just
tolerated); and dropping is skipped for tables that do not exist yet.