I have two tables, one call aluno
and another call HistoricoAluno
. After creating them, a change was made that was to leave the primary key of the alunos
table as auto_increment
. When trying to make this change I always get the following error:
Query error:
#1833 - Cannot change column 'idAluno': used in a foreign key constraint 'historicoaluno_ibfk_1' of table 'matriculas.historicoaluno
So I tried some solutions, like this:
SET FOREIGN_KEY_CHECKS = 0;
/* realizar as alterações */
SET FOREIGN_KEY_CHECKS = 1;
But I did not succeed. How can I leave the primary key of the alunos
table as auto_increment
?
I'm using mySQL in phpMyAdmin.