Skip to content

IBX-11939, IBX-12797: Merged branch '5.0' into 6.0 - #80

Merged
Steveb-p merged 7 commits into
6.0from
merge/5.0-to-6.0
Oct 30, 2026
Merged

Steveb-p merged 7 commits into
6.0from
merge/5.0-to-6.0

Conversation

@Steveb-p

Copy link
Copy Markdown
Collaborator

Steveb-p and others added 4 commits October 19, 2026 12:46
…align (#68)

* IBX-11939: Added a test case checking that both schema install paths align

Integration suites already run once on each install path: DatabaseSchemaHook executes the
SchemaBuilderEvent schema, ibexa/core's DoctrineMigrationsSchemaHook runs the Doctrine
migrations. AbstractSchemaAlignmentTestCase compares the database the suite runs on with the
schema SchemaBuilderEvent declares, so on the migrations run it fails when a migration is
missing or incomplete, listing the SQL that would make the database match.

DBAL can't read everything back the way schema.yaml declares it, so both sides leave out index
prefix lengths outside MySQL/MariaDB (and compare them as integers there), sequences, and
autoincrement on SQLite.

* IBX-11939: Extracted the connection lookup into getDatabaseConnection()

A suite may reach its database through another connection than the kernel's default one, so the
test case gets it from an overridable method, which defaults to
IbexaTestCore::getDoctrineConnection().

* IBX-11939: Moved each normalization rule into its own method

Each thing DBAL can't read back the way schema.yaml declares it now has a private method whose
name and docblock say why it's left out of the comparison: ignoreSerialColumnSequence(),
normalizeIndexPrefixLengths() and ignoreAutoincrementOnSqlite(). replaceIndexOptions() re-adds
an index with other options, since an index's options can't be changed.

* IBX-11939: Compared strings longer than the platform's VARCHAR limit as text

DBAL creates a string column longer than the platform allows as a text one (a CLOB on SQLite,
where the limit is 4000), so it reads back as text. product-catalog's description columns
(string, length 10000) showed up as different on SQLite because of that.

* IBX-11939: Exposed SchemaBuilderInterface in IbexaTestKernel

IbexaTestKernel always registers DoctrineSchemaBundle, so the schema builder is always there.
Exposing it lets AbstractSchemaAlignmentTestCase get it through
IbexaTestCore::getServiceByClassName(), like every other service a test needs, instead of
reaching into the container itself.

* IBX-11939: Extracted the schema builder lookup into getSchemaBuilder()

Like getDatabaseConnection(), it's protected so a suite can override where the schema it compares
with comes from. It defaults to the SchemaBuilderInterface the kernel exposes.

* IBX-11939: Returned early from the normalization rules that don't apply

ignoreAutoincrementOnSqlite() and treatOverlongStringAsText() now return as soon as the column or
platform isn't one they handle, instead of wrapping their whole body in a condition.

* IBX-11939: Asserted that index prefix lengths are an array instead of casting them

By the time they're read, hasOption() has ruled out null, and wherever they come from - DBAL's
schema managers or doctrine-schema's importer - they're a list with one entry per column.

* IBX-11939: Tested the schema alignment rules on real databases

- Renamed ignoreSerialColumnSequence() to ignoreSequences(): it drops every sequence, and its
  docblock now says why they aren't matched to their SERIAL columns.
- Explained on ignoreAutoincrementOnSqlite() why leaving out composite keys alone isn't enough.
- Added an integration suite (phpunit.integration.xml, composer test-integration) whose bootstrap
  installs the kernel's SchemaBuilderEvent schema:
  - SchemaAlignmentTest, an empty subclass, runs the test case itself; it passes by construction.
  - SchemaAlignmentNormalizationTest creates each case the comparison normalizes, and checks that
    it compares as declared, and on which platforms the plain comparison differs.
- CI runs it on SQLite, PostgreSQL 14, MySQL 8.0 and MariaDB 10.11.

* IBX-11939: Asserted the statements the schema comparison reports

The prefix length and VARCHAR limit cases only checked that something was reported; they now
check that it's the index or column change.

* IBX-11939: Tested the schema alignment test case through its override points

compareSchemas() was public only for this package's own tests. They now run
testDatabaseMatchesTheSchemaBuilderEventSchema() on a stub subclass that overrides
getDatabaseConnection() and getSchemaBuilder(), so it's private again.

* IBX-11939: Declared the schema alignment cases in a schema.yaml

Each case the comparison normalizes is now declared in tests/integration/Schema/_fixtures/schema.yaml,
the way packages declare their schema:
- The integration kernel adds it with core's BuildSchemaSubscriber, so the bootstrap installs it
  through SchemaBuilderEvent, and SchemaAlignmentTest compares it on every database.
- SchemaAlignmentNormalizationTest reads those tables back, instead of creating its own, and only
  checks where the plain comparison differs.
- The unit test imports the same file with doctrine-schema's SchemaImporter, instead of building
  the declared schema by hand.

* IBX-11939: Named the index and column the schema alignment test helpers change

* IBX-11939: Lowercased the platform variable names in the schema alignment test

* IBX-11939: Applied ibexa/code-style 2.3.1 to the schema alignment test case

4.6 now requires ibexa/code-style ~2.3.1 (#70), whose PHP CS Fixer wraps signatures with several
parameters, calls createStub() statically, writes empty class bodies on one line and imports the
classes docblocks refer to.
…th in a bootstrap (#73)

* IBX-11939: Added SchemaInstallPath to select either schema install path in a bootstrap

Packages that run their integration suite on both install paths each repeated the same
DatabaseSchemaHook and DoctrineMigrationsSchemaHook options. getBootstrapperOptions() returns
them for the path the package picks, so the package still decides how, usually with an
environment variable its CI sets.

* IBX-11939: Made SchemaInstallPath take whether the Doctrine Migrations path is enabled
@Steveb-p Steveb-p added the Fast-forward merge PR should be merged in a fast-forward way label Oct 29, 2026
Comment thread composer.json Outdated
"php": ">=8.5",
"doctrine/dbal": "^4.4",
"ibexa/jms-translation-bundle": "^3.0",
"league/flysystem-memory": "^2.0.6 || ^3.0",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we remove 2.0.6 from here?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dropped it in f43400a, it's ^3.0 now, same as ibexa/core on 6.0.

Comment thread .github/workflows/backend-ci.yaml Outdated
needs: tests
services:
postgres:
image: postgres:14

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does it make sense to test with 18?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added 18 next to 14 in f43400a, same matrix as ibexa/core 6.0 uses. The tmpfs had to move to /var/lib/postgresql, as the 18 image refuses to start with a mount at /var/lib/postgresql/data.

# Conflicts:
#	.gitignore
#	composer.json
#	phpunit.xml.dist
The test case merged up from 5.0 was written against DBAL 3 and PHPUnit 9:

* Read the database through SchemaAssetsFilterBypassInterface, now exposed by
  IbexaTestKernel, as 6.0 hides the tables SchemaBuilderEvent declares from
  introspection.
* Moved to DBAL 4.5: introspectSchema(), the schema manager's comparator with
  modified indexes reporting disabled, getAlterSchemaSQL(), and the schema,
  table, index and column editors instead of the deprecated mutators, as
  FrameworkBundle turns Doctrine deprecations into failures under
  failOnDeprecation.
* Dropped treatOverlongStringAsText(): DBAL 4 no longer turns an overlong
  VARCHAR into a CLOB, so the database reads it back as declared.
* On PostgreSQL, DBAL 4 reads autoincrement on a composite primary key back as
  declared, so only SQLite still needs that rule.
* Converted the tests' annotations to attributes and rewrote
  phpunit.integration.xml for PHPUnit 11.
* Ran the integration CI jobs on PHP 8.5 and passed serverVersion, which DBAL 4
  reads instead of server_version.
* Ran the PostgreSQL integration job on 14 and 18, like ibexa/core 6.0 does.
  The tmpfs moved to /var/lib/postgresql, as the 18 image refuses to start
  with a mount at /var/lib/postgresql/data.
* Required league/flysystem-memory ^3.0 only: 2.x needs league/flysystem ^2,
  which 6.0's ibexa/core doesn't allow.
@Steveb-p
Steveb-p marked this pull request as ready for review October 30, 2026 12:23
@Steveb-p
Steveb-p merged commit 473425c into 6.0 Oct 30, 2026
8 checks passed
@Steveb-p
Steveb-p deleted the merge/5.0-to-6.0 branch October 30, 2026 12:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Fast-forward merge PR should be merged in a fast-forward way

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants