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

Support Django 4 #11

Closed
PeterJCLaw opened this issue Aug 10, 2022 · 4 comments · Fixed by #15
Closed

Support Django 4 #11

PeterJCLaw opened this issue Aug 10, 2022 · 4 comments · Fixed by #15

Comments

@PeterJCLaw
Copy link
Collaborator

Discovered while adding CI versions for #9.
Currently the tests fail with: django.db.utils.ProgrammingError: relation "django_migrations" does not exist during export_migration_state.
I don't know if that's just a test setup issue or a genuine change in Django 4. A quick look at the release notes didn't reveal anything obvious unfortunately.

@aaron7-mns
Copy link

It's a change in Django: django/django#15252 where we were relying on django_migrations being created even when there are no migrations to run.

@PeterJCLaw
Copy link
Collaborator Author

Looks like we can just call MigrationRecorder(connection).ensure_schema() to have Django create the table? Not sure if that's meant to be public API or not, but seems like it would get things working.

@PeterJCLaw
Copy link
Collaborator Author

Hrm, adding MigrationRecorder(connection).ensure_schema() to the top of the export tests makes them pass. However I had thought that when this issue was seen under Django 4 it was seen at import time? 😕

@PeterJCLaw
Copy link
Collaborator Author

Ah, I think this only occurs at import time if there are any migration records to restore. If not then it looks like the access to django_migrations is skipped (by dint of using executemany on an empty list). That would explain why the tests aren't impacted (since they have no migration records).

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

Successfully merging a pull request may close this issue.

2 participants