Jira issue originally created by user @beberlei:
SchemaTool currently has to do very complex reference management to get the datastructure for schema generation working. Its completely array based, so its not easy to understand what is going on and why.
I propose to change the DBAL DDL API in the following way:
Bugs still to fix:
There are massive benefits from this:
Since DBAL Schema Creation is not a performance critical task there is no problem in going from array structures to massive object usage.
The approach is based on eZ Components DatabaseSchema component which has this view on Schema Generation and whose API is expectionally easy to use:
Comment created by lucasts:
As nowadays we had a lot of users using document-oriented databases and maybe interested in using Doctrine. I suggest at little to make possible to use DC2 DDL API to manage it.
To do that, we need to create objects :
I'll deep some more on this, and back to comment here.
Comment created by @beberlei:
But the DBAL package will the RMDBS specific, for document databases we need new packages, one for drivers, one for the ODM, so this shouldn't affect the DBAL refactoring.
Yeah, we will need some new packages.
I'm just suggesting, as to be clear document dbs don't need at all to pre-create tables, just views and databases.
but, if DBAL will be only for relational databases, no problem.
As gblanco told you, I'm preparing a migration extension specific to dc2.
about this refactoring, did you had some patch or need some help?
CouchDB for example needs to have some mechanism for automatic view generation, which will be used for the ODM package. Views in Couch work like Stored Procedures, so you have to have some mechanism to build them automatically.
Regarding DBAL Refactoring, yes i need help :-)
I poke you about it in IRC tonight.
Update Ticket with the current status of this endaveour
The refactoring is now almost finished, there is only some serious problem with foreign keys in updating/dropping. Anyone any ideas how to fix them?
Implemented and added a rough documentation on the API with a DBAL section in the manual.
Issue was closed with resolution "Fixed"