[Django] #34895: Reverse migrations fail with mysql / mariadb with sql_safe_updates set to 1

6 views
Skip to first unread message

Django

unread,
Oct 9, 2023, 6:07:39 AM10/9/23
to django-...@googlegroups.com
#34895: Reverse migrations fail with mysql / mariadb with sql_safe_updates set to 1
--------------------------------------+----------------------------
Reporter: divick | Owner: nobody
Type: Bug | Status: new
Component: Migrations | Version: 4.0
Severity: Normal | Keywords: migrations
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
--------------------------------------+----------------------------
For one of the migrations when I tried deleting, it generates something
like the following:

{{{
DELETE FROM `django_migrations` WHERE (`django_migrations`.`app` = 'cards'
AND `django_migrations`.`name` = '0023_user_pin_code');
}}}


The problem is that django_migrations.name column is not indexed nor is
django_migrations.app column, which leads to sql_safe_update error:

{{{
MySQLdb.OperationalError: (1175, 'You are using safe update mode and you
tried to update a table without a WHERE that uses a KEY column')
}}}

I think django_migrations.name column can be made unique to solve this
issue.

The version of Django that I am using is 4.0.10.

--
Ticket URL: <https://code.djangoproject.com/ticket/34895>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Oct 9, 2023, 6:25:53 AM10/9/23
to django-...@googlegroups.com
#34895: Reverse migrations fail with mysql / mariadb with sql_safe_updates set to 1
----------------------------+--------------------------------------
Reporter: divick | Owner: nobody
Type: Bug | Status: closed
Component: Migrations | Version: 4.0
Severity: Normal | Resolution: duplicate

Keywords: migrations | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
----------------------------+--------------------------------------
Changes (by Mariusz Felisiak):

* status: new => closed
* resolution: => duplicate


Comment:

Duplicate of #30490.

--
Ticket URL: <https://code.djangoproject.com/ticket/34895#comment:1>

Reply all
Reply to author
Forward
0 new messages