Here, I am new to liquibase and I have a scenario where I need to add a new column to the existing table and have the value of this column based on existing column. However I was able to add column but I couldn't find a way to set default value for this column.
consider I have a table called table_1
id | col1 | col2 |
---|---|---|
1 | 11 | 22 |
2 | 12 | 33 |
3 | 13 | 44 |
Now I want to add column col3 in the above table and have value of this column same as col2. I am expecting output something like
id | col1 | col2 | col3 |
---|---|---|---|
1 | 11 | 22 | 22 |
2 | 12 | 33 | 33 |
3 | 13 | 44 | 44 |
You've marked liquibase SQL, are you using SQL as the preferred language in your changelog?
I think if you are, a SQL statement might work:
Otherwise, you could use similar syntax in json, yaml.