salsita / node-pg-migrate

Node.js database migration management for PostgreSQL
https://salsita.github.io/node-pg-migrate
MIT License
1.28k stars 176 forks source link

Support for altering column constaints #919

Open mieradi opened 1 year ago

mieradi commented 1 year ago

Altering constraints on a specific column would be very handy. If i have missed a way to do it in the current version, please let me know.

Something like this would be great.

pgm.alterConstaints(tablename, columnname, {
    unique: false,
    references: "referencename"
  });
Shinigami92 commented 4 months ago

@mieradi Can you elaborate a bit more what you want?

Please provide some SQL examples that should be covered.

When I look into the PostgreSQL documentation, currently ALTER CONSTRAINT does not support e.g. unique and so on 🤔 https://www.postgresql.org/docs/current/sql-altertable.html#SQL-ALTERTABLE-DESC-ALTER-CONSTRAINT