Skip to content
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

Backwards Migrate with custom tables fails #4

Open
doctormo opened this issue Apr 3, 2015 · 3 comments
Open

Backwards Migrate with custom tables fails #4

doctormo opened this issue Apr 3, 2015 · 3 comments

Comments

@doctormo
Copy link

doctormo commented Apr 3, 2015

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.

@SeanHayes
Copy link
Member

Thanks for reporting this.

Could you provide a test case, or example migration? Where should only_django=False be set?

@doctormo
Copy link
Author

doctormo commented Apr 3, 2015

I've written the bones of the type of setup here: https://inkscape.org/en/gallery/item/5361/ but the error from that site in both sqlite3 and psql is about content types needing to be created. I'll try and tweak the site until I have a happy time.

@SeanHayes
Copy link
Member

@doctormo Is that the right link? It gives me a 404.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants