﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
34895	Reverse migrations fail with mysql / mariadb with sql_safe_updates set to 1	Divick	nobody	"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."	Bug	closed	Migrations	4.0	Normal	duplicate	migrations		Unreviewed	0	0	0	0	0	0
