0

I am currently doing ZF2 project with Doctrine2. I have existing database where tables does not have foreign key constraints and any relation. Using doctrine can I generate schema based on relation without foreign key constraints.

I tried to add the column without foreign key constraints and its violated. Also I tried the column null able still doctrine try to modify the db schema to add foreign key constraints which eventually fails.

Also tried to add another temporary column as foreign key and later on write a script top transfer existing column to the foreign key constraint column. But it also failed as there have some columns who does not exist in the second table( may be deleted)

still does not find any suitable way to do that.

Any idea? or its not possible?

arnobsh
  • 11
  • 2
  • Try this: http://stackoverflow.com/a/16964149/1078488 If not then perhaps use doctrine migrations to generate migration scripts for your db changes and then manually remove the foreign key statements...? – JimL Oct 10 '16 at 20:34
  • yes I tried those way. But doctrine generate FK when i try to get schema update. Now if I do manually then doctrine schema create/update/drop feature will be useless. Doctrine should have some alternative ways to make it possible. Any idea? – arnobsh Oct 10 '16 at 21:21
  • You should be able to use doctrine migrations. Running schema update (force) is either way not recommended – JimL Oct 11 '16 at 10:07
  • but it does not solve the problem. Still remains the database FK problem. Thanks anyway for the suggestion – arnobsh Oct 17 '16 at 19:38

0 Answers0