Add a test to ensure that new columns can't be used as the identity for a backfill, even if they satisfy the conditions for an identity column.
A newly added NOT NULL and UNIQUE column could in theory be used as the identity column for a backfill. However, it shouldn't be used as the identity column fora backfill because it's a newly added column whose temporary column will be full of NULLs for any existing rows in the table.
Currently the column won't be selected as an identity for backfills because the nullability and uniqueness for new column are not populated when adding it to the virtual schema in the add_column operation:
Add a test to ensure that new columns can't be used as the identity for a backfill, even if they satisfy the conditions for an identity column.
A newly added
NOT NULL
andUNIQUE
column could in theory be used as the identity column for a backfill. However, it shouldn't be used as the identity column fora backfill because it's a newly added column whose temporary column will be full of NULLs for any existing rows in the table.Currently the column won't be selected as an identity for backfills because the nullability and uniqueness for new column are not populated when adding it to the virtual schema in the add_column operation:
https://github.com/xataio/pgroll/blob/c08ef7065cdbce965110e64f58e66eddf605eaee/pkg/migrations/op_add_column.go#L61-L63
Following on from the discussion here: https://github.com/xataio/pgroll/pull/289#discussion_r1505832826