Handle static data in every version release

We are unable to figure out how to handle population of static data with identity (auto increment) column and foreign key column. Say for example, we have two static tables,

Id (Primary key and identity), short name, name

Id (Primary key and identity), Table1.Id(foreign key), details

What is the better way to populate data in the above tables on every version release using Liquibase? In the above example, using Liquibase, how do we get value of primary key column in order to insert as foreign key of second table?

We are using Postgres database.

Hi @harishankar ,

Are you able to write the changes for populating the static data using sql? If so, liquibase allows you to write your changeset with sql.

For this question:

Could you clarify what you mean? Why do you have to populate the data with every version release?




We tried writting SQL to populate data. But it is not working for us. When more than one developer needs to populate data in the same static table, then there is a clash in the identity value of the table. Thats why we need to know the better way.

Those are static/reference data. In our case there would be some new reference data for every version release. For eg, say we have table to hold list of screens through which we manage screen permission and audit log stuffs. In a release if there are new screens added then we have to populate in that table.

Harishankar Sekar
Tech. Arch.