Migration renaming in 0.18.1 is causing a Django migration error in django migrate command
See original GitHub issueHi everybody,
I recently updated procrastinate 0.16.0 to 0.18.1 and the command python manage.py migrate
is failing with the following error:
Traceback (most recent call last):
File "manage.py", line 15, in <module>
execute_from_command_line(sys.argv)
File "/usr/local/lib/python3.8/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python3.8/site-packages/django/core/management/__init__.py", line 395, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python3.8/site-packages/django/core/management/base.py", line 330, in run_from_argv
self.execute(*args, **cmd_options)
File "/usr/local/lib/python3.8/site-packages/django/core/management/base.py", line 371, in execute
output = self.handle(*args, **options)
File "/usr/local/lib/python3.8/site-packages/django/core/management/base.py", line 85, in wrapped
res = handle_func(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/django/core/management/commands/migrate.py", line 95, in handle
executor.loader.check_consistent_history(connection)
File "/usr/local/lib/python3.8/site-packages/django/db/migrations/loader.py", line 302, in check_consistent_history
raise InconsistentMigrationHistory(
django.db.migrations.exceptions.InconsistentMigrationHistory: Migration procrastinate.0002_drop_started_at_column is applied before its dependency procrastinate.0001_initial on database 'default'.
The issue was generated because this commit: https://github.com/peopledoc/procrastinate/commit/1e989e00cd20e9e866c4c6f66b62ca2251aba1bf where the 0001_baseline
migration file changed to 0001_initial
: 0 procrastinate/sql/migrations/{baseline-0.5.0.sql → 00.00.00_01_initial.sql}
. Django doesn’t know that is the same file and is creating a not applied migration for 0001
:
As a reference, In version 0.16.0 we had:
Is there a reason for changing the name of the migration? Is is possible to rollback to the original name 0001_baseline
?
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Django errors when making migrations after renaming apps
I added the models app into the migration command and it somewhat worked -- python ./manage.py makemigrations models . However, now I have...
Read more >Migrations - Django documentation
Migrations are Django's way of propagating changes you make to your models (adding a field, deleting a model, etc.) into your database schema....
Read more >Changelog — procrastinate documentation
A consequence of this, if you're using Django Migrations and ran migrations pre-0.17 is that one of the Django migrations was renamed, which...
Read more >How to Move a Django Model to Another App - Real Python
In the previous approach, you copied all the data to the new table. The migration required downtime, and it could take a long...
Read more >How to Name Django Migrations (and Why It's Important)
Roll-Back Risks: MySQL lacks support for transactions around schema alteration operations. If a migration fails, you will have to manually ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@ewjoachim I understand and it’s ok.
I know that I can probably fix it in my project easily but I don’t like to make third party library fixes in my source code.
Should this file renaming appear under Breaking changes section in the release notes?
I believe that this is now ok. Please reopen if not.