Skip to content

Backwards Migrate with custom tables fails #4

@doctormo

Description

@doctormo

When a migration starts with custom table names which have foreign keys to other app; that then get renamed to django default tables later on, the flush command breaks.

The full error: cannot truncate a table referenced in a foreign key constraint
DETAIL: Table "table_A" references "table_B".
HINT: Truncate table "table_A" at the same time, or use TRUNCATE ... CASCADE.

The error is caused perhaps by django's own code, since the flush command doesn't add the custom table names to the list of tables to flush. Setting only_django to False will fix the issue since the introspection module will correctly list lal the tables.

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