Skip to content
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

Fix Doctrine deprecations #50524

Merged
merged 1 commit into from
Jun 2, 2023
Merged

Conversation

nicolas-grekas
Copy link
Member

@nicolas-grekas nicolas-grekas commented Jun 1, 2023

Q A
Branch? 5.4
Bug fix? yes
New feature? no
Deprecations? no
Tickets Fix #50481
License MIT
Doc PR -

@carsonbot carsonbot added this to the 5.4 milestone Jun 1, 2023
@nicolas-grekas nicolas-grekas force-pushed the doctrine-deprec branch 4 times, most recently from 58e449f to cfc74e6 Compare June 2, 2023 14:35
@nicolas-grekas nicolas-grekas merged commit b4128fd into symfony:5.4 Jun 2, 2023
5 of 11 checks passed
@nicolas-grekas nicolas-grekas deleted the doctrine-deprec branch June 2, 2023 17:45
@@ -480,9 +480,11 @@ private function updateSchema(): void

$schemaManager = $this->createSchemaManager();
$comparator = $this->createComparator($schemaManager);
$schemaDiff = $this->compareSchemas($comparator, $schemaManager->createSchema(), $this->getSchema());
$schemaDiff = $this->compareSchemas($comparator, method_exists($schemaManager, 'introspectSchema') ? $schemaManager->introspectSchema() : $schemaManager->createSchema(), $this->getSchema());
Copy link
Contributor

@brusch brusch Jun 14, 2023

Choose a reason for hiding this comment

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

@nicolas-grekas actually this change deletes all existing tables in the database 😬
Reverting this code-block fixes the issue.

Copy link
Member

Choose a reason for hiding this comment

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

Can you please open a new issue if you think that this change is wrong (best with a failing example application)? Comments on closed PRs are likely to get lost.

Copy link
Member

Choose a reason for hiding this comment

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

By the way, reading the code I fail to see how this change can change the actual behaviour (the new instrospectSchema() method calls createSchema() internally).

Copy link
Contributor

Choose a reason for hiding this comment

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

@xabbuh yeah, I also thought so, but when I just reverted this code block (not the entire file) it continued to work as expected. But yes, I'll create a follow-up ticket with a reproducible case. Thanks so far 👍😊

brusch added a commit to brusch/symfony that referenced this pull request Jun 20, 2023
When using `$platform->getAlterSchemaSQL($schemaDiff)` instead of `$schemaDiff->toSaveSql($platform)` causes to call `\Doctrine\DBAL\Schema\SchemaDiff::_toSql($platform, false)` instead of `\Doctrine\DBAL\Schema\SchemaDiff::_toSql($platform, true)`.  When $saveMode=false the diff from the schema is getting remove, so actually all other tables ... in the DB are getting deleted
brusch added a commit to brusch/symfony that referenced this pull request Jun 20, 2023
This was referenced Jun 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants