Django migrations remove model CompletedTask
See original GitHub issueWhen I run migrations I got the output:
- Remove field creator_content_type from completedtask
- Delete model CompletedTask
and migration:
class Migration(migrations.Migration):
dependencies = [
('background_task', '0001_initial'),
]
operations = [
migrations.RemoveField(
model_name='completedtask',
name='creator_content_type',
),
migrations.DeleteModel(
name='CompletedTask',
),
]
and all gone good but when I run tasks django raise an error django.db.utils.OperationalError: no such table: background_task_completedtask
Why django remove this table and how can I avoid it? Should I just ignore this migration or there is some more clever way?
P.S. I already check simial questions but I didn’t find the solution.
I can fake this migration but got another problem. django-background-tasks register each task two times (I call only one time). Could you suggest how to cook it?
Issue Analytics
- State:
- Created 6 years ago
- Comments:10
Top Results From Across the Web
Stop Django background-task from deleting completed_task ...
1. If you go through each of your migration files, do any of them look like they will delete that table? · The...
Read more >How to safely remove Django model and its relations
So the only way to preserve the data of old models is to write a data migration to transfer both models data and...
Read more >Migrations - Django documentation
Workflow¶. Django can create migrations for you. Make changes to your models - say, add a field and remove a model - and...
Read more >How to Reset Migrations - Simple is Better Than Complex
Scenario 2: · 1. Make sure your models fits the current database schema · 2. Clear the migration history for each app ·...
Read more >Django Migrations: A Primer - Real Python
In Django, database migrations usually go hand in hand with models: ... SQL is also used to create, change, and delete the database...
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 Free
Top 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
I had the same problem on Django 2.1. Seems like it doesn’t correctly detect the model in
background_task.models_completed
. Will send a PR once I’m sure it looks good (basically it moves the model and queryset classes frombackground_task.models_completed
tobackground_task.models
)I also have this issue. Running django 1.11.12 and django-background-tasks (1.1.13), using a virtualenv- For the moment I’m just removing this from the migration file: 0003_auto_20180417_1203.py