Skip to content

IBX-11939: [Doctrine Migrations] Added Doctrine Migrations-based schema and data install path#784

Draft
Steveb-p wants to merge 2 commits into
4.6from
doctrine-migrations-installer
Draft

IBX-11939: [Doctrine Migrations] Added Doctrine Migrations-based schema and data install path#784
Steveb-p wants to merge 2 commits into
4.6from
doctrine-migrations-installer

Conversation

@Steveb-p

@Steveb-p Steveb-p commented Jul 16, 2026

Copy link
Copy Markdown
Contributor
Question Answer
JIRA issue IBX-11939
Type feature
Target Ibexa version v4.6
BC breaks no

See also #785 for an alternative implementation that inlines all SQL directly into the migration classes (via addSql()) instead of using the AbstractVersion + YAML manifest + one-SQL-statement-per-file mechanism used here.

Adds an ibexa/doctrine-migrations-based alternative to the event-driven SchemaBuilderEvent mechanism CoreInstaller currently uses to install the core schema and bootstrap data, controlled by a new ibexa.installer.schema_builder_event.enabled setting (defaults to true, preserving current behavior).

  • Enabled (default): CoreInstaller keeps dispatching SchemaBuilderEvent and importing cleandata.sql directly - unchanged.
  • Disabled: schema creation and data import are each modeled as an AbstractVersion migration (InstallSchemaMigration, ImportDataMigration), tagged with IbexaMigrationTag for discovery, and executed via the new TaggedMigrationsRunner through IbexaOnlyDependencyFactory - an independent Doctrine Migrations DependencyFactory scoped to only Ibexa-tagged migrations, so a project's own migrations are never accidentally picked up. Each migration's execution is recorded in the standard Doctrine Migrations versioning table, making repeated installs idempotent.

InstallSchemaMigration's SQL (mysql/postgresql/sqlite, one statement per file, grouped in the YAML manifest by table/index/constraint across platforms) is generated from the existing schema.yaml. ImportDataMigration's SQL is generated from the existing per-DBMS cleandata.sql files, with the mysql statements also reused verbatim for sqlite (which previously had no cleandata support at all).

Requires ibexa/doctrine-migrations (currently tracked via its feat/doctrine-migrations branch, added as a VCS repository).

Checklist:

  • Provided PR description.
  • Tested the solution manually.
  • Provided automated test coverage.
  • Checked that target branch is set correctly (main for features, the oldest supported for bugs).
  • Ran PHP CS Fixer for new PHP code (use $ composer fix-cs).
  • Asked for a review (ping @ibexa/engineering).

… install path

Adds an ibexa/doctrine-migrations-based alternative to the event-driven
SchemaBuilderEvent mechanism CoreInstaller has used to install the core
schema and bootstrap data. Controlled by the new
"ibexa.installer.schema_builder_event.enabled" setting (defaults to true,
preserving current behavior):

- When enabled (default), CoreInstaller keeps dispatching
  SchemaBuilderEvent and importing cleandata.sql directly, unchanged.
- When disabled, schema creation and data import are each modeled as an
  AbstractVersion migration (InstallSchemaMigration, ImportDataMigration),
  tagged for discovery, and executed via TaggedMigrationsRunner through
  the new IbexaOnlyDependencyFactory service - an independent Doctrine
  Migrations DependencyFactory scoped to only Ibexa-tagged migrations, so
  a project's own migrations are never accidentally executed. Each
  migration's execution is recorded in the standard Doctrine Migrations
  versioning table, making repeated installs idempotent.

InstallSchemaMigration's SQL (mysql/postgresql/sqlite, one statement per
file) is generated from the existing schema.yaml; ImportDataMigration's
from the existing per-DBMS cleandata.sql files (with the mysql statements
reused verbatim for sqlite, which previously had no cleandata support at
all).
Symfony\Component\DependencyInjection\ServiceLocator is not a generic
class, so PHPStan rejects the ServiceLocator<Installer> PHPDoc type used
for InstallPlatformCommand::$installers. Removed the invalid generic
parameter; the type-hint itself (plain ServiceLocator) is unaffected.
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
6.9% Duplication on New Code (required ≤ 3%)
E Security Rating on New Code (required ≥ A)
C Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

💡 Need a hand with PR review? Try Gitar by Sonar!

@Steveb-p Steveb-p changed the title [Doctrine Migrations] Added Doctrine Migrations-based schema and data install path IBX-11939: [Doctrine Migrations] Added Doctrine Migrations-based schema and data install path Jul 17, 2026
@Steveb-p
Steveb-p requested a review from a team July 20, 2026 07:34
@ibexa-workflow-automation-1
ibexa-workflow-automation-1 Bot requested review from ViniTou, alongosz, barw4, bnowak, ciastektk, konradoboza, mikadamczyk, tbialcz and wiewiurdp and removed request for a team July 20, 2026 07:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants