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
Move schema split for SQLite CREATE INDEX only #6352
base: 3.8.x
Are you sure you want to change the base?
Conversation
c4a7206
to
0d1617e
Compare
There is no functional test included. We're making assertions purely on the generated SQL. Thus, the test does not really reproduce a bug that's fixed with this change. Furthermore, you're testing an implementation detail: how the table name is passed from If I'm not mistaken, this change is supposed to fix a problem regarding the creation of primary keys on tables outside of the |
$indexDef = new Index('i', ['a', 'b']); | ||
self::assertSame( | ||
'CREATE INDEX main.i ON mytable (a, b)', | ||
$this->platform->getCreateIndexSQL($indexDef, 'main.mytable'), | ||
); |
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.
This method contains two test scenarios in a single test. Furthermore, this first scenario is green without your changes. It does not really cover anything.
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.
I have split the test into two.
The first test tests if expected SQL is generated when a table name with schema is given.
The second test tests if unmodified table/column is passed to SqlitePlatform::getCreatePrimaryKeySQL()
.
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.
@derrabus does this explanation makes sense to you?
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.
@derrabus can I please get your approval here?
0d1617e
to
d24cf43
Compare
d24cf43
to
20fbd75
Compare
This comment hasn't been addressed as far as I can tell: #6352 (comment) |
Function test (ie. test with DB) cannot be made as https://github.com/doctrine/dbal/blob/3.8.4/src/Platforms/SqlitePlatform.php#L995 always throws. Thus the test is coded to test the behaviour using overrided method. |
If the scenario is an overridden platform, can't we run a functional test with an overridden platform? |
Adding/altering primary key is not supported by SQLite using one SQL statement, thus I belive the current test cannot be coded better. In anycase, we need to override the platform method to test this. This is what the current test does. It does not change the behaviour in sense of any currently generated SQL, but fixes what is passed to a public overridable method. |
Summary
SqlitePlatform::getCreatePrimaryKeySQL
method must receive original table name, the split is intended for SQLiteCREATE INDEX
statement only.