Not the answer you need?
Register and ask your own question!
Many Forum changes were implemented on Tue 22 Sep. Read about new Ranks, Scoring, and Reactions.
Email [email protected] for any comments or concerns.

Changing datatypes of foreign keys

omakaseomakase EntrantInactive User Role Beginner
I want to change the data type of all my id fields in my (InnoDB) schema from mediumints to ints. The problem is there are a lot of foreign key references and I can't figure out a simple way to change the type other than removing all he foreign key constraints, changing the columns and adding all the foreign key constraints again.

Is there an easier way?


  • danciulinarudanciulinaru Entrant Inactive User Role Beginner
    Step 1:

    Step 2:
    mysql> ALTER TABLE table_name modify column data type;


    Basically, is what said, but instead of removing fk, you're just disabling them.
Sign In or Register to comment.

MySQL, InnoDB, MariaDB and MongoDB are trademarks of their respective owners.
Copyright ©2005 - 2020 Percona LLC. All rights reserved.