Add new column that is not nullable and historic data
hi!
I wanted to ask what's the best practice for the following scenario:
a new column is added to a versioned table. the new column should not be nullable. a default value can not be given, instead the initial value must be set with an additional SQL script as it depends on some calculation/logic.
also for the history data the column should be set, at least to some default value because the new column is needed for some operations on the data that still must work when going back in time.
the first part is rather easy: we can add the column as nullable, patch all the current data and everything's fine so far.
but what about the history? and how do we move the column to the not-nullable state?
is it possible to patch the history data in the _LT table? not adding/removing rows, just setting the new column to some values.
and after that we could set the column to not nullable then.
anyone an idea on that?
kind regards,
Andreas Schilling