Skip to content

Migrations schema dump result SQL has incorrect order #1493

Open
@Bart-Westenenk

Description

@Bart-Westenenk

Bug Report

Q A
BC Break no
Version 3.4.1

Summary

Foreign key constraints depend on both tables and columns existing. The schema dump command first creates the table, then adds the foreign keys while the foreign table does not exist yet.

Current behavior

doctrine:migrations:schema-dump dumps the schema table per table.

How to reproduce

Have a relatively simple schema with 2 entities that depend on eachother using associations (and thus foreign key constraints)

Run the following commands, and see that the last command fails:

  • php bin/console doctrine:database create
  • php bin/console doctrine:database:update --force
  • php bin/console doctrine:migrations:schema-dump
  • php bin/console doctrine:database:drop --force
  • php bin/console doctrine:database:create
  • php bin/console doctrine:migrations:migrate -n

Expected behavior

I expect the last commad to complete and run the migration given by doctrine:migrations:schema-dump succesfully.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions