mirror of
https://github.com/doctrine/orm.git
synced 2026-04-29 09:23:20 +02:00
Schemas not working in SQLite anymore since ORM 3 #7326
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @ThomasLandauer on GitHub (Feb 13, 2024).
Bug Report
Summary
In https://github.com/doctrine/dbal/pull/4805 the schema emulation for SQLite was removed from DBAL. Could it be that it was forgotten to integrate this into the ORM (as suggested by that PR)?
How to reproduce
I created a migration:
It has lines such as:
(This used to be
CREATE TABLE myschema__mytablein the previous versions)When I run it, I'm getting:
The table in the entity is defined like this:
@derrabus commented on GitHub (Feb 13, 2024):
You need to "create" that schema by attaching an additional SQLite file. That's how schemas work in SQLite, see https://www.sqlite.org/lang_attach.html
You can do so using a custom middleware for example. Alternatively, we could think about adding a config param to DBAL for configuring the schemas.
Closing because there's nothing we can do about it in the ORM.
@c33s commented on GitHub (Feb 29, 2024):
@derrabus had the same issue. any chance to bring the old behavior back? it is quite a common use case to use sqlite on the CI while using postgres in production. hope it is ok if i comment here as bringing back the old behavior using attributes would be part of the ORM would it?
shifting the handling to the userspace is quite sad as the feature worked perfectly before. would you mind to share your thoughts how this can be done in a middleware?
would you mind to explain that a little bit. how would it work to map specific entities to specific schemas? do you think of configuring it like having multiple database?
@derrabus commented on GitHub (Feb 29, 2024):
Convince me that I want to maintain an emulation of a feature that all supported database systems support natively. Otherwise, no chance.
Yes, and nobody wants to stop you from doing that.
I've posted a link on how additional databases can be attached in SQLite. The DBAL middleware system is also documented.
Yes.
@mvorisek commented on GitHub (Mar 10, 2024):
The solution is to add schema/ATTACH support to DBAL, ie. to support it in SQLite DBAL platform and manager. I can implement under on paid basis as I am interested in the schema support for atk4/data project.