0

I'm trying to change the type on the PRIMARY KEY from INT to UNSIGNED INT on MySQL server because I'm nearing the end of the INT range.

I tried to make a query

ALTER TABLE table_name CHANGE id id INT UNSIGNED AUTO_INCREMENT NOT NULL

As you can probably guess, this affects the ability to write to this table. Can you suggest a solution that will allow you to freely write to the table (without the risk of data loss) when executing ALTER TABLE?

I will add that ALTER TABLE takes about 25 minutes to complete.

Also I try to use pt-online-schema-change but I have many database servers to which I need to execute this change and it would be much more convenient and easier for me to do it through the migration system that is in Symfony (doctrine)

Adabler
  • 34
  • 4
  • Does this answer your question? [ALTER TABLE without locking the table?](https://stackoverflow.com/questions/463677/alter-table-without-locking-the-table) – bschaffh Jun 26 '23 at 12:07
  • Thanks for the answer @bschaffh. Unfortunately, this doesn't necessarily solve my problem. I have to implement such a change on a large number of databases and it would be best to do it through the migration system provided by Symfony (Doctrine). I wanted to use `pt-online-schema-change` but I'm just limited by the number of databases to change. – Adabler Jun 26 '23 at 12:16
  • Hi - if you have specific requirements that any solution needs to meet then please update your question to reflect this rather than add additional information in comments. Someone should be able to fully understand your question by reading it, without needing to then work through any comments to see if they also contain relevant information – NickW Jun 26 '23 at 12:49
  • Hi. Thanks for comment. I'm already working on updating the post. Thanks – Adabler Jun 26 '23 at 12:51

0 Answers0