-
-
Notifications
You must be signed in to change notification settings - Fork 215
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Apply schema filter more selectively #587
base: 3.4.x
Are you sure you want to change the base?
Conversation
c32b617
to
b6d8f19
Compare
public function testItDisablesItselfWhenTheCurrentCommandIsAMigrationsCommand(): void | ||
public function testItFiltersOutMigrationMetadataTableWhenRunningSpecificCommands(): void | ||
{ | ||
$listener = new SchemaFilterListener('doctrine_migration_versions'); | ||
$migrationsCommand = new class extends DoctrineCommand { | ||
$migrationsCommand = new class ($this->createStub(EntityManagerProvider::class)) extends ValidateSchemaCommand { | ||
}; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this still a valid test as the opposite for testItFiltersOutMigrationMetadataTableWhenRunningSpecificCommands()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The name is no longer valid, since the filter no longer disables itself (it's disabled by default and stays so until enabled).
There is another test that tests that it's disabled by default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It isn't about the name but about the 2 cases where we have an instance of UpdateCommand or ValidateSchemaCommand and not having an instance of ValidateSchemaCommand or UpdateCommand. onConsoleCommand
is currently only covering one of those cases. UpdateCommand isn't covered either.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed, I think.
Isn't useless for mongo-odm users ? Since you're doing only instanceof check, I'm not sure you need to require the package. The best way to solve this might be to
But I didn't found a package used by both orm and migrationBundle. (That would end in the famous doctrine/contract package). Until them I think you can keep the instanceof check without requiring ORM. |
You're right, I'll revert this change. |
b6d8f19
to
e17a608
Compare
For #584, this solution currently hides the toolbar indicator. If we reactivate it, it still indicates that none of the migrations have been executed |
@victor-paumier I don't understand how that's possible, given that with this solution, the filter will never be enabled in the context of HTTP. Maybe there is a cache you need to clear? |
I just enable it manually, I just wanted to know if it was the expected result. |
You enabled the filter? Why? |
There is only one call to it.
1e8ff6b
to
47cfdb3
Compare
It is more careful, since there seems to be a lot of situations where we do not want to apply the filter. Let us take the opposite approach and: - Have the filter disabled by default, instead of enabled by default. - Enable it for precise commands where we know we need it.
47cfdb3
to
31417c0
Compare
It is more careful, since there seems to be a lot of situations where we do not want to apply the filter.
Let us take the opposite approach and:
This means the ORM is no longer just a dev dependency.
Fixes #584, fixes #585
How can I test this?
composer config repositories.greg0ire vcs https://github.com/greg0ire/DoctrineMigrationsBundle composer require doctrine/doctrine-migrations-bundle "dev-selective-filter as 3.4.0"