#28677: on_delete is a required positional argument for ForeignKeys, even in
migrations
-------------------------------------+-------------------------------------
Reporter: Christian | Owner: nobody
Kreuzberger |
Type: Bug | Status: new
Component: Migrations | Version: 2.0
Severity: Normal | Resolution:
Keywords: migration | Triage Stage:
foreignkey on_delete | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Christian Kreuzberger):
* status: closed => new
* resolution: invalid =>
Comment:
Sorry if re-opening this ticket is against the rules, but I just tried
squashing the migrations and I ran into the same problem.
I squashed the migrations with Django 1.11 and then upgraded to Django
2.0a1. Here are my migrations:
https://github.com/anx-
ckreuzberger/user_foreign_key_testapp/tree/master/polls/migrations
And here is my squashed migration:
https://github.com/anx-
ckreuzberger/user_foreign_key_testapp/blob/master/polls/migrations/0001_initial_squashed_0005_auto_20160414_1351.py
When applying migrations on an empty database, I am getting the following
error with Django 2.0a1:
{{{
File "/home/travis/build/anx-
ckreuzberger/user_foreign_key_testapp/polls/migrations/0004_actualvote.py",
line 10, in <module>
class Migration(migrations.Migration):
File "/home/travis/build/anx-
ckreuzberger/user_foreign_key_testapp/polls/migrations/0004_actualvote.py",
line 22, in Migration
('choice', models.ForeignKey(verbose_name=b'Which choice was chosen?',
to='polls.Choice')),
TypeError: __init__() missing 1 required positional argument: 'on_delete'
}}}
I have the feeling that squashing migrations is not helping in this
scenario, and therefore commit 491eb56fd4dea10248ccced90c31ed64152d09cb
should be adapted accordingly.
It seems the only way to get this working is to edit ALL migration files
that have been created with Django 1.8 or before. Django 1.9+ should be
fine AFAIK.
--
Ticket URL: <https://code.djangoproject.com/ticket/28677#comment:5>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/074.d46a3eaa2382d1fdcbe49958b8c756c6%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.