Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to change id column type already registered in the database

I’m trying to change my Id column type from int to bigInt because the records are too big and I’m getting an error if I try to store more records but I’m not sure if it’s safe to just alter the table like this:

 alter table the_table
     alter the_column type bigint;

I’m using Java Springboot to create the entities and Hibernate for persistence. What’s the best way to solve this issue in a safe way since there are very important records inside the DB?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Why can’t you just do this?

ALTER TABLE tableName ALTER COLUMN ID bigint

I guess try it in a test environment first but this always works for me

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading