Skip to content

Fix create_column_from migration helper not copying all constraints

The create_column_from migration helper is copying to the new column the indexes, foreign keys and NOT NULL settings (the NULLABLE property, not a constraint), but skips any additional constraints that may exist in the original table.

As an example, we may have NOT NULL constraints added with add_not_null_constraint, limits on text columns added with add_text_limit or other arbitrary check constraints added with add_check_constraint.

We should update create_column_from to find and copy all the CHECK constraints from the old column to the new one.

Edited by Yannis Roussos