#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.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018b13e805f6-871fd7c4-f3db-4771-8d30-34ec0b283f20-000000%40eu-central-1.amazonses.com.

Reply via email to