-
Notifications
You must be signed in to change notification settings - Fork 106
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
If a column with a primary key constraint on it is altered by pgroll
, the primary key constraint is lost after completing the operation.
Migration to reproduce the issue:
operations:
- alter_column:
column: myid
down: "CAST(\"myid\" AS bigint)"
table: my_table
type: uuid
up: "gen_random_uuid"
Broken schema:
# \d my_table;
Table "public.my_table"
Column | Type | Collation | Nullable | Default
-----------+--------------------------+-----------+----------+---------
myid | uuid | | not null |
Indexes:
"my_table_pkey" UNIQUE, btree ("myid")
The primary key constraint is missing.
Workaround
Run a second migration to apply primary key constraint again:
operations:
- create_constraint:
name: my_table_pk
columns: [myid]
table: my_table
up:
myid: myid
down:
myid: myid
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working