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

Allow to disable schema emulation on SQLite #5517

Merged
merged 1 commit into from
Jul 21, 2022

Conversation

mvorisek
Copy link
Contributor

@mvorisek mvorisek commented Jul 17, 2022

Q A
Type bug
Fixed issues #5517

Summary

Needed for atk4/data#1033

@mvorisek
Copy link
Contributor Author

Guys, can this PR be merged as is as no tests is failing after the "eat prefixed tables" hack from 2011 has been removed? Or what test you want me to write?

@derrabus
Copy link
Member

Looks like a duplicate of #4804.

@mvorisek
Copy link
Contributor Author

Yes, it was fixed as part of #4804. Can it be backported to DBAL 3.3.x or to 3.4.x at least?

@derrabus
Copy link
Member

If you find a backwards-compatible way to do so, we can probably discuss it. But this PR in its current form is a BC break unfortunately.

@mvorisek
Copy link
Contributor Author

I will update this PR to move the str_replace('.', '__', ...) into protected method, so developer can override it. And it will stay backwards-compatible/unchanged in DBAL 3.x /w empty merge commit to 4.x.

@mvorisek mvorisek changed the title Fix Sqlite schema/attach support Fix Sqlite schema/attach support, allow to backport 4804 by the developer Jul 17, 2022
@mvorisek mvorisek marked this pull request as ready for review July 17, 2022 14:49
@mvorisek
Copy link
Contributor Author

done

@derrabus derrabus changed the base branch from 3.3.x to 3.4.x July 18, 2022 09:27
@derrabus derrabus added this to the 3.4.0 milestone Jul 18, 2022
derrabus
derrabus previously approved these changes Jul 18, 2022
Copy link
Member

@derrabus derrabus left a comment

Choose a reason for hiding this comment

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

LGTM. @morozov, what do you think?

@mvorisek
Copy link
Contributor Author

@derrabus is there anything againt to land this into 3.3.x? It is a kind of a bugfix.

@derrabus
Copy link
Member

You're creating a new extension point which is beyond what a bugfix should do imho.

@mvorisek
Copy link
Contributor Author

I am fixing "unhacked table name" support (see https://github.com/doctrine/dbal/pull/5517/files#r922818649) in BC way.

As long as the user does not override SqlitePlatform class and not implement emulateSchemaInTableName method in it, which is super unlikely, there is no single BC break.

@derrabus
Copy link
Member

there is no single BC break

I'm not saying that there is one, am I? Why does it matter so much to you that we rush this into a bugfix release?

@mvorisek
Copy link
Contributor Author

In atk4/data framework, I need to support working with multiple Sqlite databases. Without this PR, I would have to override and copy paste the fixed impl. in every method of SqlitePlatform class that uses the "eat prefixed tables" hack.

@morozov
Copy link
Member

morozov commented Jul 18, 2022

Introducing a protected method to allow overriding it to disable its functionality looks like a hack. If we want this behavior to be configurable, we need to add an API, e.g.

public function setUseBooleanTrueFalseStrings($flag)
{
$this->useBooleanTrueFalseStrings = (bool) $flag;
}

The pull request is missing a description (as well as the linked issue) and tests.

As for whether to backport it to 3.3.x, most likely, 3.4.0 and 3.3.8 will be released together, so there's no point in backporting the patch IMO.

@mvorisek mvorisek changed the base branch from 3.4.x to 3.3.x July 18, 2022 14:47
@mvorisek mvorisek dismissed derrabus’s stale review July 18, 2022 14:47

The base branch was changed.

@mvorisek mvorisek changed the base branch from 3.3.x to 3.4.x July 18, 2022 14:47
@mvorisek
Copy link
Contributor Author

I will add the option as in PostgreSQLPlatform. And a test /w ATTACH if the no other SqlitePlatform fixes will be needed.

About the targeting - if 3.4 will be out soon, it seems ok.

@mvorisek mvorisek marked this pull request as draft July 18, 2022 14:49
Copy link
Member

@derrabus derrabus left a comment

Choose a reason for hiding this comment

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

The name of the new switch should reflect the feature that we're about to remove.

That being said, should that switch affect the return value of canEmulateSchemas() as well?

src/Platforms/SqlitePlatform.php Outdated Show resolved Hide resolved
src/Platforms/SqlitePlatform.php Outdated Show resolved Hide resolved
src/Platforms/SqlitePlatform.php Outdated Show resolved Hide resolved
src/Platforms/SqlitePlatform.php Outdated Show resolved Hide resolved
@mvorisek
Copy link
Contributor Author

The name of the new switch should reflect the feature that we're about to remove.

That being said, should that switch affect the return value of canEmulateSchemas() as well?

Good point, I think yes to be consistent with #4804

src/Platforms/SqlitePlatform.php Outdated Show resolved Hide resolved
src/Platforms/SqlitePlatform.php Outdated Show resolved Hide resolved
src/Platforms/SqlitePlatform.php Outdated Show resolved Hide resolved
derrabus
derrabus previously approved these changes Jul 18, 2022
@derrabus derrabus marked this pull request as ready for review July 18, 2022 21:24
src/Platforms/SqlitePlatform.php Outdated Show resolved Hide resolved
src/Platforms/SqlitePlatform.php Show resolved Hide resolved
src/Platforms/SqlitePlatform.php Outdated Show resolved Hide resolved
@morozov
Copy link
Member

morozov commented Jul 18, 2022

Please squash the commits before the merge. The history of code changes in the feature branch isn't necessary to be stored in the repository history.

@derrabus derrabus changed the title Fix Sqlite schema/attach support, allow to backport 4804 by the developer Allow to disable schema emulation on SQLite Jul 19, 2022
@mvorisek
Copy link
Contributor Author

Feedback addressed and squashed.

@morozov morozov merged commit 647871b into doctrine:3.4.x Jul 21, 2022
@mvorisek mvorisek deleted the fix_sqlite_schema_support branch July 21, 2022 08:19
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants