Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
126 commits
Select commit Hold shift + click to select a range
1e471d9
[Doctrine Migrations] Added Doctrine Migrations-based schema and data…
Steveb-p Jul 16, 2026
6afd592
Fixed PHPStan generics error on ServiceLocator<Installer>
Steveb-p Jul 17, 2026
4fcae33
[Doctrine Migrations] Inlined SQL directly into migration classes
Steveb-p Jul 17, 2026
41d610d
[Doctrine Migrations] Reformatted long/multiline SQL using NOWDOC
Steveb-p Jul 17, 2026
85932b7
IBX-11939: Adopted AbstractSqlMigration for platform-separated SQL
Steveb-p Jul 21, 2026
e541a73
IBX-11939: Aborted migration on unsupported database platform
Steveb-p Jul 22, 2026
9a45d05
IBX-11939: Added trailing semicolons to migration SQL files
Steveb-p Jul 22, 2026
cd4e979
IBX-11939: Added schema/data-presence guards for legacy-install migra…
Steveb-p Jul 23, 2026
d80ab8c
IBX-11939: Recorded schema-guarded migrations as applied, not skipped
Steveb-p Jul 23, 2026
2793d9f
IBX-11939: Fixed 4.6 baseline guards to check the branch's own table …
Steveb-p Jul 23, 2026
d9a8f61
IBX-11939: Added a SchemaProvider bridging Doctrine Migrations to Sch…
Steveb-p Jul 24, 2026
f24e93d
IBX-11939: Fixed PHP 7.4 compatibility in SchemaBuilderEventSchemaPro…
Steveb-p Jul 24, 2026
59f4eb2
IBX-11939: Addressed review feedback (arrow-fn style, removed redunda…
Steveb-p Jul 27, 2026
6c01f5a
IBX-11939: Removed ibexa/doctrine-migrations VCS repository entry
Steveb-p Jul 27, 2026
a32be8d
IBX-11939: Made TaggedMigrationsRunner's DependencyFactory dependency…
Steveb-p Jul 28, 2026
ba37dc1
IBX-11939: Enforced list<Query> return from getQueriesFromSchemaBuild…
Steveb-p Jul 28, 2026
ecdde0c
Added guarded migrations for core content/URL performance indexes
Steveb-p Jul 28, 2026
5ba8807
Fixed guard crash on installs that never had the pre-rename table
Steveb-p Jul 29, 2026
7d2781f
Removed pre-4.6-origin AddContentPerformanceIndexesMigration, folded …
Steveb-p Jul 29, 2026
16db7e8
Fix ibexa/doctrine-migrations constraint to track the 4.6 branch
Steveb-p Jul 30, 2026
16b5226
Fix TaggedMigrationsRunner passing an empty Schema to every migration
Steveb-p Jul 30, 2026
69d960f
Move core's own Doctrine Migrations into IbexaCoreBundle
Steveb-p Jul 30, 2026
5b3eae7
Fix SQLite-dialect bugs in InstallSchemaMigration/ImportDataMigration…
Steveb-p Jul 30, 2026
5b395f8
IBX-11939: Switched the install SQL to utf8mb4
Steveb-p Sep 20, 2026
9c53e7c
IBX-11939: Added a Bootstrapper hook installing the schema via Doctri…
Steveb-p Sep 19, 2026
1b0f6bd
IBX-11939: Added append-only fixtures, which do not truncate before i…
Steveb-p Sep 20, 2026
29b0cb3
Merged branch '4.6' into doctrine-migrations-installer-inline-sql
Steveb-p Sep 22, 2026
8dc0288
IBX-11939: Aligned the test fixture's language IDs with the default i…
Steveb-p Sep 24, 2026
22c4586
Merge remote-tracking branch 'origin/4.6' into doctrine-migrations-in…
Steveb-p Sep 24, 2026
3be78fd
Revert "IBX-11939: Aligned the test fixture's language IDs with the d…
Steveb-p Sep 24, 2026
58948f4
Merge remote-tracking branch 'origin/4.6' into doctrine-migrations-in…
Steveb-p Sep 25, 2026
efe6338
Merged branch 'doctrine-migrations-installer-inline-sql' into 5.0 (ba…
Steveb-p Sep 25, 2026
3e897ff
IBX-11939: [Doctrine Migrations] Added Doctrine Migrations-based sche…
Steveb-p Sep 25, 2026
e684216
IBX-11939: Added a shared SchemaBuilderEvent subscriber for plain ORM…
Steveb-p Sep 26, 2026
71c2606
Merge remote-tracking branch 'origin/doctrine-migrations-installer-in…
Steveb-p Sep 26, 2026
261e2ba
Merge remote-tracking branch 'origin/base/ibx-11939-4.6-merged-5.0' i…
Steveb-p Sep 26, 2026
1ff4219
IBX-11939: Adapted OrmEntitiesSchemaSubscriber and its test to 5.0
Steveb-p Sep 26, 2026
49cff09
IBX-11939: Pointed the bundle_installer test suite at tests/bundle/Re…
Steveb-p Sep 26, 2026
b5ff977
IBX-11939: Fixed code style of OrmEntitiesSchemaSubscriber's constructor
Steveb-p Sep 26, 2026
96b9231
IBX-11939: Fixed the stale installer type in IbexaInstallerExtensionTest
Steveb-p Sep 26, 2026
5d2d30d
IBX-11939: Took the installers as a ServiceLocator in InstallPlatform…
Steveb-p Sep 27, 2026
55cd509
IBX-11939: Fixed PHPStan and code style after the ServiceLocator change
Steveb-p Sep 27, 2026
7e7debc
Merged branch 'feature/fix-schema-rename-migration-5.0-postgres' into…
Steveb-p Sep 27, 2026
62a30e6
IBX-11939: Adapted the Doctrine Migrations install path to 6.0
Steveb-p Sep 27, 2026
dfe9d80
IBX-11939: Lifted the schema assets filter for TaggedMigrationsRunner…
Steveb-p Sep 27, 2026
61e77c6
IBX-11939: Renamed the index behind ibexa_content_type_field_definiti…
Steveb-p Sep 28, 2026
9e13d66
Merged branch 'feature/fix-schema-rename-migration-5.0-postgres' into…
Steveb-p Sep 28, 2026
fc9d8d2
Merged branch 'base/ibx-11939-4.6-5.0-merged-6.0' into feature/fix-sc…
Steveb-p Sep 28, 2026
8944243
IBX-11939: Added the 6.0 content version constraints migration
Steveb-p Sep 28, 2026
cf2b90b
IBX-11939: Typed the closures in OrmEntitiesSchemaSubscriber
Steveb-p Sep 28, 2026
5edc32a
IBX-11939: Typed the closures in OrmEntitiesSchemaSubscriber
Steveb-p Sep 28, 2026
01d0866
IBX-11939: Ran tagged migrations through Doctrine's Migrator
Steveb-p Sep 28, 2026
cbba249
IBX-11939: Marked DoctrineMigrationsSchemaHook as internal
Steveb-p Sep 28, 2026
5b5ff98
IBX-11939: Renamed bootstrapper.yml to bootstrapper.yaml
Steveb-p Sep 28, 2026
efdf4bd
Merge remote-tracking branch 'origin/doctrine-migrations-installer-in…
Steveb-p Sep 28, 2026
00d3880
Merge remote-tracking branch 'origin/base/ibx-11939-4.6-merged-5.0' i…
Steveb-p Sep 28, 2026
cc5668b
IBX-11939: Named the failing statement when a tagged migration fails
Steveb-p Sep 28, 2026
28ac914
Merge remote-tracking branch 'origin/6.0' into base/ibx-11939-4.6-5.0…
Steveb-p Sep 28, 2026
2668c1e
Merge remote-tracking branch 'origin/feature/fix-schema-rename-migrat…
Steveb-p Sep 28, 2026
95701c9
Merge remote-tracking branch 'origin/base/ibx-11939-4.6-5.0-merged-6.…
Steveb-p Sep 28, 2026
194ae92
IBX-11939: Adapted TaggedMigrationsRunnerTest to 6.0
Steveb-p Sep 28, 2026
f75405c
IBX-11939: Added a dedicated exception for failing tagged migrations
Steveb-p Sep 28, 2026
a44b7ff
Merge remote-tracking branch 'origin/doctrine-migrations-installer-in…
Steveb-p Sep 28, 2026
2be3612
Merge remote-tracking branch 'origin/base/ibx-11939-4.6-merged-5.0' i…
Steveb-p Sep 28, 2026
4dcd162
Merged branch 'feature/fix-schema-rename-migration-5.0-postgres' into…
Steveb-p Sep 28, 2026
ff0f36c
Merge remote-tracking branch 'origin/base/ibx-11939-4.6-5.0-merged-6.…
Steveb-p Sep 28, 2026
06ca13b
[Doctrine Migrations] Added Doctrine Migrations-based schema and data…
Steveb-p Jul 16, 2026
e2fb82d
Fixed PHPStan generics error on ServiceLocator<Installer>
Steveb-p Jul 17, 2026
71d6e6b
[Doctrine Migrations] Inlined SQL directly into migration classes
Steveb-p Jul 17, 2026
19bcfb8
[Doctrine Migrations] Reformatted long/multiline SQL using NOWDOC
Steveb-p Jul 17, 2026
4bcfa9f
IBX-11939: Adopted AbstractSqlMigration for platform-separated SQL
Steveb-p Jul 21, 2026
6fdbab5
IBX-11939: Aborted migration on unsupported database platform
Steveb-p Jul 22, 2026
f50c07f
IBX-11939: Added trailing semicolons to migration SQL files
Steveb-p Jul 22, 2026
ca94d3e
IBX-11939: Added schema/data-presence guards for legacy-install migra…
Steveb-p Jul 23, 2026
af2a87d
IBX-11939: Recorded schema-guarded migrations as applied, not skipped
Steveb-p Jul 23, 2026
243b982
IBX-11939: Fixed 4.6 baseline guards to check the branch's own table …
Steveb-p Jul 23, 2026
48fbfde
IBX-11939: Added a SchemaProvider bridging Doctrine Migrations to Sch…
Steveb-p Jul 24, 2026
1675c26
IBX-11939: Fixed PHP 7.4 compatibility in SchemaBuilderEventSchemaPro…
Steveb-p Jul 24, 2026
5234b2b
IBX-11939: Addressed review feedback (arrow-fn style, removed redunda…
Steveb-p Jul 27, 2026
e97aad6
IBX-11939: Removed ibexa/doctrine-migrations VCS repository entry
Steveb-p Jul 27, 2026
a910163
IBX-11939: Made TaggedMigrationsRunner's DependencyFactory dependency…
Steveb-p Jul 28, 2026
ebda9fc
IBX-11939: Enforced list<Query> return from getQueriesFromSchemaBuild…
Steveb-p Jul 28, 2026
f79f6b0
Added guarded migrations for core content/URL performance indexes
Steveb-p Jul 28, 2026
d436bd4
Fixed guard crash on installs that never had the pre-rename table
Steveb-p Jul 29, 2026
7ec9a72
Removed pre-4.6-origin AddContentPerformanceIndexesMigration, folded …
Steveb-p Jul 29, 2026
d3df09d
Fix ibexa/doctrine-migrations constraint to track the 4.6 branch
Steveb-p Jul 30, 2026
3ef4eca
Fix TaggedMigrationsRunner passing an empty Schema to every migration
Steveb-p Jul 30, 2026
e4d1637
Move core's own Doctrine Migrations into IbexaCoreBundle
Steveb-p Jul 30, 2026
e9ecffb
Fix SQLite-dialect bugs in InstallSchemaMigration/ImportDataMigration…
Steveb-p Jul 30, 2026
f29ebeb
IBX-11939: Switched the install SQL to utf8mb4
Steveb-p Sep 20, 2026
64c989c
IBX-11939: Added a Bootstrapper hook installing the schema via Doctri…
Steveb-p Sep 19, 2026
1b87874
IBX-11939: Added append-only fixtures, which do not truncate before i…
Steveb-p Sep 20, 2026
f049e94
IBX-11939: Ran tagged migrations through Doctrine's Migrator
Steveb-p Sep 28, 2026
b8acaf2
IBX-11939: Marked DoctrineMigrationsSchemaHook as internal
Steveb-p Sep 28, 2026
68e673c
IBX-11939: Renamed bootstrapper.yml to bootstrapper.yaml
Steveb-p Sep 28, 2026
ab9534e
IBX-11939: Added a dedicated exception for failing tagged migrations
Steveb-p Sep 28, 2026
2583d4b
Merge remote-tracking branch 'origin/5.0' into base/ibx-11939-4.6-mer…
Steveb-p Sep 29, 2026
46f1830
Merge remote-tracking branch 'origin/doctrine-migrations-installer-in…
Steveb-p Sep 29, 2026
64befcb
Merge remote-tracking branch 'origin/base/ibx-11939-4.6-merged-5.0' i…
Steveb-p Sep 29, 2026
d8be9eb
Merge remote-tracking branch 'origin/6.0' into base/ibx-11939-4.6-5.0…
Steveb-p Sep 29, 2026
5f7aed8
Merged branch 'feature/fix-schema-rename-migration-5.0-postgres' into…
Steveb-p Sep 29, 2026
03505c4
Merge remote-tracking branch 'origin/base/ibx-11939-4.6-5.0-merged-6.…
Steveb-p Sep 29, 2026
ca72e6b
IBX-11939: Replaced SqlPlatform with doctrine-schema's DatabasePlatfo…
Steveb-p Oct 1, 2026
20db372
IBX-11939: Replaced SqlPlatform with doctrine-schema's DatabasePlatfo…
Steveb-p Oct 1, 2026
721a377
IBX-11939: Replaced SqlPlatform with doctrine-schema's DatabasePlatfo…
Steveb-p Oct 1, 2026
1564f46
Merge remote-tracking branch 'origin/5.0' into base/ibx-11939-4.6-mer…
Steveb-p Oct 1, 2026
e775d2f
Merge remote-tracking branch 'origin/doctrine-migrations-installer-in…
Steveb-p Oct 1, 2026
1853d1c
Merge remote-tracking branch 'origin/base/ibx-11939-4.6-merged-5.0' i…
Steveb-p Oct 1, 2026
9be7a89
Merge remote-tracking branch 'origin/6.0' into base/ibx-11939-4.6-5.0…
Steveb-p Oct 1, 2026
da76237
Merge remote-tracking branch 'origin/feature/fix-schema-rename-migrat…
Steveb-p Oct 1, 2026
25b7b5a
Merge remote-tracking branch 'origin/base/ibx-11939-4.6-5.0-merged-6.…
Steveb-p Oct 1, 2026
d8dc342
IBX-11939: Wrapped long lines in the Doctrine Migrations SQL files
Steveb-p Oct 1, 2026
6fe672f
Merge remote-tracking branch 'origin/doctrine-migrations-installer-in…
Steveb-p Oct 1, 2026
9fd1f96
Merge remote-tracking branch 'origin/base/ibx-11939-4.6-merged-5.0' i…
Steveb-p Oct 1, 2026
81d6de3
Merge remote-tracking branch 'origin/feature/fix-schema-rename-migrat…
Steveb-p Oct 1, 2026
00913ab
Merge remote-tracking branch 'origin/base/ibx-11939-4.6-5.0-merged-6.…
Steveb-p Oct 1, 2026
59d1520
IBX-11939: Added MariaDB to the platforms the migrations support
Steveb-p Oct 2, 2026
c351f4a
IBX-11939: Created the tables with JSON columns the way Doctrine DBAL…
Steveb-p Oct 2, 2026
c3c39ab
IBX-11939: Targeted AddUrlAliasMlLinkIndexMigration at 4.6.21
Steveb-p Oct 2, 2026
f801939
Merge remote-tracking branch 'origin/doctrine-migrations-installer-in…
Steveb-p Oct 2, 2026
c8d79aa
Merge remote-tracking branch 'origin/base/ibx-11939-4.6-merged-5.0' i…
Steveb-p Oct 2, 2026
7d77111
IBX-11939: Added MariaDB to the platforms the 5.0 migrations support
Steveb-p Oct 2, 2026
59e6d2c
Merge remote-tracking branch 'origin/feature/fix-schema-rename-migrat…
Steveb-p Oct 2, 2026
388a170
Merge remote-tracking branch 'origin/base/ibx-11939-4.6-5.0-merged-6.…
Steveb-p Oct 2, 2026
4dc5ed4
IBX-11939: Added MariaDB to the platforms the 6.0 migrations support
Steveb-p Oct 2, 2026
cf3d771
IBX-11939: Added the missing ON UPDATE CASCADE to ezcontentclass_attr…
Steveb-p Oct 4, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"friendsofphp/proxy-manager-lts": "^1.0",
"friendsofsymfony/http-cache-bundle": "^3.3",
"friendsofsymfony/jsrouting-bundle": "^3.6",
"ibexa/doctrine-migrations": "~6.0.x-dev",
"ibexa/doctrine-schema": "~6.0.x-dev",
"ibexa/jms-translation-bundle": "^3.0",
"league/flysystem-memory": "^2.0.6",
Expand Down
6 changes: 0 additions & 6 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -2994,12 +2994,6 @@ parameters:
count: 1
path: src/bundle/RepositoryInstaller/Command/InstallPlatformCommand.php

-
message: '#^Method Ibexa\\Bundle\\RepositoryInstaller\\Command\\InstallPlatformCommand\:\:__construct\(\) has parameter \$installers with no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
count: 1
path: src/bundle/RepositoryInstaller/Command/InstallPlatformCommand.php

-
message: '#^Method Ibexa\\Bundle\\RepositoryInstaller\\Command\\InstallPlatformCommand\:\:cacheClear\(\) has no return type specified\.$#'
identifier: missingType.return
Expand Down
39 changes: 39 additions & 0 deletions src/bundle/Core/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ public function getConfigTreeBuilder(): TreeBuilder
$this->addUrlWildcardsSection($rootNode);
$this->addOrmSection($rootNode);
$this->addUITranslationsSection($rootNode);
$this->addInstallerSection($rootNode);

// Delegate SiteAccess config to configuration parsers
$this->mainSiteAccessConfigParser->addSemanticConfig($this->generateScopeBaseNode($rootNode));
Expand Down Expand Up @@ -566,4 +567,42 @@ private function addUITranslationsSection(ArrayNodeDefinition $rootNode): void
->end()
->end();
}

/**
* Defines configuration for the "ibexa:install" installer.
*
* The configuration is available at:
* <code>
* ibexa:
* installer:
* schema_builder_event:
* enabled: true
* </code>
*
* @param \Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition $rootNode
*/
private function addInstallerSection(ArrayNodeDefinition $rootNode): ArrayNodeDefinition
{
return $rootNode
->children()
->arrayNode('installer')
->children()
->arrayNode('schema_builder_event')
->info('Configuration of the legacy, event-driven database schema building mechanism used by the "ibexa:install" command')
->children()
->booleanNode('enabled')
->defaultTrue()
->info(
'Whether "ibexa:install" dispatches Ibexa\Contracts\DoctrineSchema\Event\SchemaBuilderEvent ' .
'to let packages contribute their database schema via an event subscriber, as opposed to ' .
'the schema being installed from static SQL migrations. ' .
'Disable once all installed packages have migrated away from the event-driven mechanism.'
)
->end()
->end()
->end()
->end()
->end()
->end();
}
}
14 changes: 14 additions & 0 deletions src/bundle/Core/DependencyInjection/IbexaCoreExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ public function load(array $configs, ContainerBuilder $container): void

// Base services and services overrides
$loader->load('services.yml');
// Doctrine Migrations for core's own schema, alongside the legacy SchemaBuilderEvent path
$loader->load('doctrine_migrations.yml');
// Security services
$loader->load('security.yml');
// HTTP Kernel
Expand All @@ -141,6 +143,7 @@ public function load(array $configs, ContainerBuilder $container): void
$this->registerUrlWildcardsConfiguration($config, $container);
$this->registerOrmConfiguration($config, $container);
$this->registerUITranslationsConfiguration($config, $container);
$this->registerInstallerConfiguration($config, $container);

// Routing
$this->handleRouting($config, $container, $loader);
Expand Down Expand Up @@ -315,6 +318,17 @@ private function registerUITranslationsConfiguration(array $config, ContainerBui
$container->setParameter('ibexa.ui.translations.enabled', $config['ui']['translations']['enabled'] ?? false);
}

/**
* @param array<string, mixed> $config
*/
private function registerInstallerConfiguration(array $config, ContainerBuilder $container): void
{
$container->setParameter(
'ibexa.installer.schema_builder_event.enabled',
$config['installer']['schema_builder_event']['enabled'] ?? true
);
}

/**
* Handle routing parameters.
*
Expand Down
48 changes: 48 additions & 0 deletions src/bundle/Core/Resources/config/doctrine_migrations.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
services:
Ibexa\Bundle\RepositoryInstaller\Migration\InstallSchemaMigration:
autowire: true
public: false
arguments:
$connection: '@ibexa.persistence.connection'
tags:
- { name: !php/const Ibexa\Contracts\DoctrineMigrations\Migrations\IbexaMigrationTag::TAG }

Ibexa\Bundle\RepositoryInstaller\Migration\AddUrlAliasMlLinkIndexMigration:
autowire: true
public: false
arguments:
$connection: '@ibexa.persistence.connection'
tags:
- { name: !php/const Ibexa\Contracts\DoctrineMigrations\Migrations\IbexaMigrationTag::TAG }

Ibexa\Bundle\RepositoryInstaller\Migration\RenameSchemaTo5_0Migration:
autowire: true
public: false
arguments:
$connection: '@ibexa.persistence.connection'
tags:
- { name: !php/const Ibexa\Contracts\DoctrineMigrations\Migrations\IbexaMigrationTag::TAG }

Ibexa\Bundle\RepositoryInstaller\Migration\ImportDataMigration:
autowire: true
public: false
arguments:
$connection: '@ibexa.persistence.connection'
tags:
- { name: !php/const Ibexa\Contracts\DoctrineMigrations\Migrations\IbexaMigrationTag::TAG }

Ibexa\Bundle\RepositoryInstaller\Migration\FixLegacyIdentifiersMigration:
autowire: true
public: false
arguments:
$connection: '@ibexa.persistence.connection'
tags:
- { name: !php/const Ibexa\Contracts\DoctrineMigrations\Migrations\IbexaMigrationTag::TAG }

Ibexa\Bundle\RepositoryInstaller\Migration\AddContentVersionUniqueIndexMigration:
autowire: true
public: false
arguments:
$connection: '@ibexa.persistence.connection'
tags:
- { name: !php/const Ibexa\Contracts\DoctrineMigrations\Migrations\IbexaMigrationTag::TAG }
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
<?php

/**
* @copyright Copyright (C) Ibexa AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/
declare(strict_types=1);

namespace Ibexa\Bundle\RepositoryInstaller\Bootstrapper;

use Ibexa\Bundle\RepositoryInstaller\Migration\TaggedMigrationsRunner;
use Ibexa\Contracts\Test\Core\Bootstrapper\DatabaseSchemaHook;
use Ibexa\Contracts\Test\Core\Bootstrapper\FixtureHook;
use Ibexa\Contracts\Test\Core\Bootstrapper\HookInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

/**
* @internal for internal use by Ibexa packages' integration test setup
*
* Installs the database schema the way a real `ibexa:install` does when the SchemaBuilderEvent path
* is turned off: by running every Ibexa-tagged Doctrine migration via {@see TaggedMigrationsRunner}
* — the very same service {@see \Ibexa\Bundle\RepositoryInstaller\Installer\CoreInstaller} uses, so
* a test database built this way is built by the production code path, not by a re-implementation
* of it.
*
* This is the counterpart of {@see DatabaseSchemaHook}, and the two are mutually exclusive: each
* creates the same tables, so enabling both makes the second one fail on tables that already exist.
* Running an integration suite once with each is what proves the two install paths converge.
*
* Unlike every other built-in hook, this one is **disabled by default**. Enabling it by default
* would add a second schema install on top of {@see DatabaseSchemaHook}'s in every existing suite,
* breaking all of them the moment this package is upgraded. Opt in per bootstrap run, turning the
* legacy path off in the same breath:
*
* ```php
* (new Bootstrapper())->bootstrap(null, [
* DatabaseSchemaHook::class => [DatabaseSchemaHook::OPTION_LOAD_SCHEMA => false],
* DoctrineMigrationsSchemaHook::class => [DoctrineMigrationsSchemaHook::OPTION_INSTALL_SCHEMA => true],
* ]);
* ```
*
* Registered only in the "test" environment, and removed from the container along with
* {@see TaggedMigrationsRunner} itself when "ibexa/doctrine-migrations" isn't installed/enabled, by
* {@see \Ibexa\Bundle\RepositoryInstaller\DependencyInjection\Compiler\RemoveTaggedMigrationsRunnerPass}.
*/
final class DoctrineMigrationsSchemaHook implements HookInterface
{
/**
* Fixed tag priority this hook is registered at — after ibexa/test-core's
* {@see DatabaseSchemaHook} (1000), before its {@see FixtureHook} (900).
*
* Ordering against DatabaseSchemaHook only matters when both are enabled, which is a
* misconfiguration; running second makes that misconfiguration fail at a predictable point
* ("table already exists" out of the migrations) rather than in whichever order the tag
* collection happened to produce.
*/
public const PRIORITY = 990;

public const OPTION_INSTALL_SCHEMA = 'install_schema';

private TaggedMigrationsRunner $taggedMigrationsRunner;

public function __construct(TaggedMigrationsRunner $taggedMigrationsRunner)
{
$this->taggedMigrationsRunner = $taggedMigrationsRunner;
}

public function configureOptions(OptionsResolver $resolver): void
{
$resolver->define(self::OPTION_INSTALL_SCHEMA)
->default(false)
->allowedTypes('bool');
}

public function __invoke(array $options): void
{
if (!$options[self::OPTION_INSTALL_SCHEMA]) {
return;
}

// Executions stay recorded in the Doctrine Migrations versioning table on purpose - that
// is what a real install leaves behind, and it is what makes a second run (a test calling
// the installer itself, say) correctly skip instead of re-applying. Contrast with
// ibexa/migrations' MigrationHook, which resets its own bookkeeping because its migrations
// are test fixtures rather than part of the installed state.
$this->taggedMigrationsRunner->run();
}
}
18 changes: 11 additions & 7 deletions src/bundle/RepositoryInstaller/Command/InstallPlatformCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
use Symfony\Component\Console\Output\BufferedOutput;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
use Symfony\Component\DependencyInjection\ServiceLocator;
use Symfony\Component\Process\PhpExecutableFinder;
use Symfony\Component\Process\Process;

Expand All @@ -45,16 +46,19 @@ final class InstallPlatformCommand extends Command
/** @var string */
private $environment;

/** @var \Ibexa\Bundle\RepositoryInstaller\Installer\Installer[] */
private $installers = [];
/** @var \Symfony\Component\DependencyInjection\ServiceLocator<\Ibexa\Bundle\RepositoryInstaller\Installer\Installer> */
private ServiceLocator $installers;

private RepositoryConfigurationProviderInterface $repositoryConfigurationProvider;

private SchemaAssetsFilterBypassInterface $schemaAssetsFilterBypass;

/**
* @param \Symfony\Component\DependencyInjection\ServiceLocator<\Ibexa\Bundle\RepositoryInstaller\Installer\Installer> $installers
*/
public function __construct(
Connection $connection,
array $installers,
ServiceLocator $installers,
CacheItemPoolInterface $cachePool,
string $environment,
RepositoryConfigurationProviderInterface $repositoryConfigurationProvider,
Expand All @@ -74,7 +78,7 @@ protected function configure(): void
$this->addArgument(
'type',
InputArgument::OPTIONAL,
'The type of install. Available options: ' . implode(', ', array_keys($this->installers)),
'The type of install. Available options: ' . implode(', ', array_keys($this->installers->getProvidedServices())),
'ibexa-oss'
);
$this->addOption(
Expand Down Expand Up @@ -104,7 +108,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
if ($installer === false) {
$output->writeln(
"Unknown install type '$type', available options in currently installed Ibexa package: " .
implode(', ', array_keys($this->installers))
implode(', ', array_keys($this->installers->getProvidedServices()))
);
exit(self::EXIT_UNKNOWN_INSTALL_TYPE);
}
Expand Down Expand Up @@ -235,11 +239,11 @@ private function indexData(OutputInterface $output, $siteaccess = null)
*/
private function getInstaller($type)
{
if (!isset($this->installers[$type])) {
if (!$this->installers->has($type)) {
return false;
}

return $this->installers[$type];
return $this->installers->get($type);
}

/**
Expand Down

This file was deleted.

Loading
Loading