0

Can not alter table because animal id is foreign key in different table

 ALTER TABLE 'animal' CHANGE 'animal_id' 'animal_id' INT(11) NOT NULL AUTO_INCREMENT;
Ergest Basha
  • 7,870
  • 4
  • 8
  • 28
Hardi Patel
  • 45
  • 1
  • 5

2 Answers2

0

Because I can't see your full code, however, I think you can try this:

ALTER TABLE 'animal' MODIFY 'animal_id INT(11) AUTO_INCREMENT;
0

I think you could do something similar to this response: How to update primary key. When you update the PK, I think you could do something like this response: Alter a MySQL column to be AUTO_INCREMENT.

But since this response is not best practice, if you don't need the data in the table, you could drop and then recreate the table.

Jack
  • 397
  • 4
  • 13