How can I add a computed column in liquibase? When I run the following SQL in a sql tag I get the computed value I'm expecting:
ALTER TABLE TableName
ADD ComputedColumn AS (CASE WHEN DateColumn1 IS NULL OR DateColumn2 IS NULL
THEN 0
ELSE DATEDIFF(DAY, DateColumn1, DateColumn2) END)
How do I do this without using an sql tag? I am able to get a column created with the following yaml:
- addColumn:
tableName: TableName
columns:
- column:
name: ComputedColumn
type: tinyint
constraints:
nullable: true
defaultValueComputed: 0
valueComputed: DATEDIFF(DAY, DateColumn1, DateColumn2) END
However the column type is not Computed like when I run the raw SQL.