8000 Allow to disable SQLite schema emulation in SqliteSchemaManager by mvorisek · Pull Request #6337 · doctrine/dbal · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Allow to disable SQLite schema emulation in SqliteSchemaManager #6337

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

Merged
merged 1 commit into from
May 28, 2025

Conversation

mvorisek
Copy link
Contributor
@mvorisek mvorisek commented Mar 18, 2024
Q A
Type bug
Fixed issues #6314

Summary

Missed in #4804 and fix related #5517.

When merging up (into 4.x), simply remove the str_replace.

@derrabus
Copy link
Member

Can we cover this with a test please?

@mvorisek
Copy link
Contributor Author
mvorisek commented Mar 18, 2024

Is your request for a one functional test into Doctrine\DBAL\Tests\Functional\Schema\SqliteSchemaManagerTest?

@mvorisek
Copy link
Contributor Author

@derrabus may I understand your wishes better?

@derrabus
Copy link
Member

A test please.

@mvorisek mvorisek force-pushed the fix_6314_sqlite_schema_emulation branch 7 times, most recently from 6245c62 to 49f86b9 Compare April 5, 2024 19:28
@mvorisek mvorisek force-pushed the fix_6314_sqlite_schema_emulation branch 4 times, most recently from 1c6cc29 to 150fa23 Compare April 6, 2024 22:32
@greg0ire greg0ire requested a review from derrabus April 7, 2024 06:51
@mvorisek
Copy link
Contributor Author

@derrabus may I ask you for a review?

@derrabus
Copy link
Member

Sure. It's on my todo list, but I don't have much time to spend on open source work at the moment.

@mvorisek mvorisek force-pushed the fix_6314_sqlite_schema_emulation branch from 150fa23 to 19b8299 Compare May 3, 2024 08:06
@derrabus
Copy link
Member
derrabus commented May 3, 2024

I don't quite understand this test, tbh. You're testing with a dot in a table name that SQLite to my astonishment seems to accept when quoted. But that doesn't have much to do with schema emulation. Shouldn't the test work with a table from an actual secondary schema?

@mvorisek
Copy link
Contributor Author
mvorisek commented May 3, 2024

The fixed methods accept database name using 1st parameter, the table name is accepted as 2nd parameter, thus the 2nd parameter can be unquoted and dot must be preserved (it cannot contain schema).

As the fixed methods cannot be reached easily from public API as table with schema and dot is not fully supported yet, the test is coded to call the fixed protected methods.

@derrabus
Copy link
Member
derrabus commented May 3, 2024

As the fixed methods cannot be reached easily from public API as table with schema and dot is not fully supported yet, the test is coded to call the fixed protected methods.

So, what does this PR fix then? An implementation detail?

@mvorisek
Copy link
Contributor Author
mvorisek commented May 3, 2024

The schema manager can be extended by user classes and the protected methods must behave as expected. This PR fixes the behaviour and it is tested with functional test. For more details, see the #4804 and #5517 PRs, ie. the schema emulation is deprecated for 3.x and removed in 4.x. Can we agree on this? Is there anything else I should do?

@mvorisek mvorisek requested a review from greg0ire May 5, 2024 06:51
@derrabus derrabus dismissed greg0ire’s stale review August 14, 2024 11:00

The base branch was changed.

@mvorisek mvorisek force-pushed the fix_6314_sqlite_schema_emulation branch 2 times, most recently from 913f249 to ee4cf6f Compare October 1, 2024 12:43
@mvorisek mvorisek force-pushed the fix_6314_sqlite_schema_emulation branch from ee4cf6f to b480519 Compare October 25, 2024 09:41
@mvorisek
Copy link
Contributor Author

@derrabus the test was adjusted, can I have your final review?

@derrabus
Copy link
Member

I'm touring conferences this week. Please ping me again if I haven't reviewed the PR by the end of next week.

@mvorisek mvorisek force-pushed the fix_6314_sqlite_schema_emulation branch from b480519 to a13e983 Compare November 26, 2024 23:08
@mvorisek mvorisek marked this pull request as draft February 6, 2025 22:38
@mvorisek mvorisek force-pushed the fix_6314_sqlite_schema_emulation branch from a13e983 to 77b6081 Compare February 7, 2025 12:13
@mvorisek
Copy link
Contributor Author
mvorisek commented Feb 7, 2025

@derrabus rebased and pinging you as requested, I hope you enjoyed the conferences!

@mvorisek mvorisek marked this pull request as ready for review February 7, 2025 13:56
@mvorisek
Copy link
Contributor Author

I'm touring conferences this week. Please ping me again if I haven't reviewed the PR by the end of next week.

@derrabus pinging you again :)

@mvorisek
Copy link
Contributor Author

@derrabus pinging you again

@mvorisek
Copy link
Contributor Author

@greg0ire might I have your review? @derrabus requested me to ping him, but he seems not responsive, not sure what happened. I would be happy if we can move this PR forward. Thank you!

@greg0ire
Copy link
Member
greg0ire commented May 12, 2025

Please squash your commits. Once this is merged, nobody needs to know you wrote non functional tests at some point.

While squashing, please improve your commit message according to the contributing guide.

Right now it says that you "fix something unwanted"… unwanted stuff is avoided, not fixed. More importantly, you should state why you're doing this. Reading the test, I can see that you need to have a custom schema manager to even hit the bug, so this warrants an explanation, it's not obvious this only ever causes issue when using a custom schema manager

static fn (array $row) => [$row['table_name'], $row['name']],
$customSqliteSchemaManager->selectTableColumnsWithSchema(),
),
);
Copy link
Member

Choose a reason for hiding this comment

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

To reviewers: only this assertion fails without the bugfix… it fails like so:

1) Doctrine\DBAL\Tests\Functional\Schema\SqliteSchemaManagerTest::testListTableNoSchemaEmulation
Failed asserting that two arrays are identical.
--- Expected
+++ Actual
@@ @@
-Array &0 (
-    0 => Array &1 (
-        0 => 'list_table_no_schema_emulation.test'
-        1 => 'id'
-    )
-    1 => Array &2 (
-        0 => 'list_table_no_schema_emulation.test'
-        1 => 'parent_id'
-    )
-)
+Array &0 ()

The schema emulation is a deprecated feature.

The SqlitePlatform does support disabling the schema emulation already, the SqliteSchemaManager should support it too to ease the migration path between 3.x and 4.x.

The test requires custom SqliteSchemaManager because the current SqliteSchemaManager  impl. does not support tables with schema yet.
@mvorisek mvorisek force-pushed the fix_6314_sqlite_schema_emulation branch from 77b6081 to 7d710c9 Compare May 12, 2025 20:19
@mvorisek mvorisek changed the title Fix unwanted SQLite schema emulation in SqliteSchemaManager Allow to disable SQLite schema emulation in SqliteSchemaManager May 12, 2025
@mvorisek
Copy link
Contributor Author

Squashed and repushed.

Copy link
Member
@greg0ire greg0ire left a comment

Choose a reason for hiding this comment

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

Great commit message, please write them like this from now on.

A concern I have is that this change is here to support a feature that can only be enabled by overriding the schema manager, but why not… there is not much harm IMO since it will be gone in 4.0 (right?).

@greg0ire
Copy link
Member

@derrabus @SenseException please review

@greg0ire greg0ire added this to the 3.9.5 milestone May 28, 2025
@greg0ire greg0ire merged commit ebdc51c into doctrine:3.9.x May 28, 2025
56 checks passed
@greg0ire
Copy link
Member

Thanks @mvorisek !

@mvorisek mvorisek deleted the fix_6314_sqlite_schema_emulation branch May 28, 2025 12:58
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.

4 participants
0