-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
pdo_sqlite: DROP TABLE not working with dots #2577
Comments
I updated the links with their absolute references (don't link directly from @infinit89 the schema diff is used within the schema tool of ORM, so you can probably dump the diff and we can write a test starting from there? |
I'm not sure how to get to compare the schema, I'll try to provide more info of how I'm reproducing this error. The example entity:
Using SQLite as Driver, I do:
And then I expect the given results, being the first correct:
Inside createSchema, a dump() of $createSchemaSql = $this->getCreateSchemaSql($classes); shows:
This is good! perfect, but just after that (with the create table executed) I do:
And inside dropSchema, a dump of $dropSchemaSql = $this->getDropSchemaSQL($classes); shows:
And the expected result should be:
Let me know how to provide more info or be more helpful. |
Bug and expected output seem clear, but still need to be presented as isolated test case in order to be inspected. Is the I'm thinking that the bug may be here |
Sorry I didn't link that part, the bug is there, where you point, Indeed in first comment I copied that part of code but forgot to link it. Replying your question: No, the DropSchemaSqlCollector does not contain any tables during execution here. |
Well, I've fork the doctrine2 project and made a test expecting to fail, surprising it didn't fail and passed. Tomorrow at work I will see why there the result was different and copy this test (because I saw the error at work). Still if the test is valid I can make a pull request of the test case. |
@infinit89 as far as I can see the schema support for SQLite is incomplete and not working for your case. The schema comparator simply can't compare namespaced database objects because reverse engineering ( |
We would need some kind of reserved characters for identifiers in ORM to have a separator that we can use for this purpose. But that is not possible in |
I've trying to create a DB with names as
aaa.bbb
with SQLite. With the create table everything works fine, it just change the "." char to "__" here.But this behaviour is not good when trying to delete the table, because to get the name of the table to delete doesn't follow the same rules.
I'm not sure if the bugs belongs here or to dotrine/ORM, because the getSchemaFromMetadata is the funcion that doesn't get the correct name from SQLite table.
Table name:
aaa.bbb
is created as aaa_bbbTable name returned by DropSchemaSqlColector::getSchemaFromMetadata: aaa.bbb
When it tries to check if exists to be deleted
$schema->hasTable($table->getName())
is always false. So it's possible to create a table but never delete it.The high level code I'm using where I see all this is:
The entity should be name with a dot:
I'm not sure how to create a test case that fails to show the problem.
The text was updated successfully, but these errors were encountered: