Related to #6246
When we recreate primary keys during migration, we set new primary keys columns to not null:
|
if err := c.setNullOnPks(ctx, table); err != nil { |
However we don't remove not null enforcement on previous primary keys.
Since we also don't delete renamed columns, when we try to insert new data to the table, the old column is populated with NULL and the insert fails.
Proposed solution(s)
- Solution 1 - Look for all
not null columns and remove the enforcement when recreating primary keys
- Solution 2 - If after the migration the table has
not null columns that are not part of the new schema, fail the migration