You're not out of luck!!
First, drop all foreign keys from all the tables D2 is managing.
Copy & execute the result of this query:
SET SESSION group_concat_max_len=8192; -- // increase this if you do not see the full list of your tables
SELECT IFNULL(REPLACE(GROUP_CONCAT('ALTER TABLE ',TABLE_NAME,' DROP FOREIGN KEY ',CONSTRAINT_NAME,'; '), ',', ''), '') FROM information_schema.TABLE_CONSTRAINTS WHERE CONSTRAINT_TYPE='FOREIGN KEY';
Then override the supportsForeignKeyConstraints()
method in /vendor/doctrine-dbal/lib/Doctrine/DBAL/Platforms/MySqlPlatform.php
(or wherever this class is located) to:
public function supportsForeignKeyConstraints()
{
return false;
}
This will stop Doctrine from creating foreign key constraints on your next doctrine:schema:update
command. After that you can simply execute an ALTER TABLE PARTITION BY...
statement where needed (D2 doesn't support partitioning on a schema level). I recommend you backup & truncate your tables first (using --no-create-info
) in order to have the structure changes executed as fast as possible and then restore them.
As this fellow says here, and based on my personal experience, D2 doesn't care whether you have FKs or not, as long as the proper relation definitions are in place.
P.S.: I'm currently working on extending the annotation syntax to support proper table & column definitions, including ENGINE
(this might be useful), PARTITION BY
& the @Column options
array (i.e. {"fixed"=true, "unsigned"=true, "default"=0}
)
The overall effort amounts to a couple of sleepless nights for reverse-engineering & code patches, hope you do it faster :)