Adding column without deleting the existing records from table

Hi Team,

I have created the table with 5 column and inserted the records, later added the new column using “addcolumn” tag. But liquibase deleted the existing records and created new table with new column so lost all the existing data in DB

Is it possible to do add new column, change datatype of exiting column without deleting the existing records in table? If yes any documentation and steps needs to be followed?

Goal : Basically need to add new column, change datatype of exiting column dynamically without deleting the existing records, is it possible can you please share us the steps needs to be followed?

Note  : I have used the postgres DB

Something strange must have happened, because the behavior you want is the expected behavior. Can you share the changelog you used and the steps that you took? I’m happy to help figure out what went wrong, but will need more data. 

When changing the datatype of an existing column, there are additional considerations - for example, if you are widening a text column, that usually can be done without data loss. But making a text column smaller could result in data loss if any of the data is longer than the new column size. 

Steve Donie

Principal Software Engineer
Liquibase Community Engagement
Datical, Inc.


Thanks for reply, I was setting the below property as true so it was dropping all the table and creating new table. 

I have set it to false and it was not deleting the existing table and records while adding the new column

 SpringLiquibase liquibase = new SpringLiquibase();


Can you please share us any link which include detailed documentation with examples about migration in liquibase