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
Missing foreign keys from dump-schema command #1163
Comments
were those FK defined in your ORM mappings?
|
They are defined on entities (annotations) but with the autogenerated name.
That's odd because when I look on the If it's not supposed to rely on database schema, maybe it should be added to the command description and service descriptions because it is a little misleading as of now : MigrationsDumpSchemaDoctrineCommand.php
SchemaDumper.php
When I saw "current database schema" and "current state of your database schema", I thought it was refering to the database, not the database mapping. |
SchemaDumper is indeed not dumping the foreign keys. It only dumps the table definitions. Instead of creating the SQL queries itself, it should reuse the DBAL machinery for that (or use DiffGenerator with |
Please add an option to set AbstractPlatform::CREATE_FOREIGNKEYS in lib/Doctrine/Migrations/SchemaDumper.php:91 |
Well, the proper fix is described in my previous comment. But we need someone to implement it. |
Probably the best way now is to use |
@jacekkarczmarczyk bin/console doctrine:migrations:diff --from-empty-schema |
@gsjurebus thanks, but this looks like a Symfony solution, I don't use Symfony, I'd expect a native doctrine solution without using external libs |
Bug Report
Summary
Original issue : #820
While a solution was proposed to generate a diff from empty schema, in my use case, I cannot generate a schema from an empty diff.
Use case :
I need to :
dump-schema
which contains all constraints including FKCurrent behavior
Foreign keys are missing from the schema dumped and DB diff generate foreign keys
How to reproduce
Expected behavior
Foreign keys are dumped into the migration file
Workaround
Dump structure from MySQL and create the migration manually
The text was updated successfully, but these errors were encountered: