pgroll icon indicating copy to clipboard operation
pgroll copied to clipboard

Alter column operations should allow specification of unchanged fields

Open andrew-farries opened this issue 3 months ago • 0 comments

Alter column operations should support specifying fields that are unchanged as no-ops.

For example, this migration:

{
  "name": "35_alter_column_multiple",
  "operations": [
    {
      "alter_column": {
        "table": "events",
        "column": "name",
        "name": "event_name",
        "nullable": false,
        "up": "(SELECT CASE WHEN name IS NULL THEN 'placeholder' ELSE name END)",
        "down": "name"
      }
    }
  ]
}

Renames a field and sets it to NOT NULL. If the field is already NOT NULL, the operation should not perform any column duplication or backfilling to support setting the column nullability.

andrew-farries avatar Apr 12 '24 01:04 andrew-farries