You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Columns that are duplicated as part of an 'alter column' migration that changes the column type should not attempt to duplicate any DEFAULTs or CHECK constraints that are not compatible with the new column type.
will fail because the length_check constraint can't be applied to the new column type. A similar problem occurs if the column has a string default and the column type is changed to an integer.
As a first pass, it could be acceptable to simply drop defaults and constraints from columns that have their type changed; users can re-set them in the same 'alter column' operation that changes the type if they are intended to be preserved.
Ideally the default/constraints should be dropped if they are not compatible with the new column type and preserved otherwise.
The text was updated successfully, but these errors were encountered:
…n type (#349)
When a column is duplicated with a new type, check constraints and
defaults defined on the column *may* be incompatible with the new type.
In this case column duplication should not fail, but rather the
incompatible constraints and defaults should be ignored and not be
duplicated to the new column.
This PR changes column duplication to ignore errors on `DEFAULT` and
`CHECK` constraint duplication that look as though they are caused by a
change of column type.
Fixes#348
Columns that are duplicated as part of an 'alter column' migration that changes the column type should not attempt to duplicate any
DEFAULT
s orCHECK
constraints that are not compatible with the new column type.Given this pair of migrations:
will fail because the
length_check
constraint can't be applied to the new column type. A similar problem occurs if the column has a string default and the column type is changed to an integer.As a first pass, it could be acceptable to simply drop defaults and constraints from columns that have their type changed; users can re-set them in the same 'alter column' operation that changes the type if they are intended to be preserved.
Ideally the default/constraints should be dropped if they are not compatible with the new column type and preserved otherwise.
The text was updated successfully, but these errors were encountered: