Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sequelize Migration Remove Primary Key

I was reading through the sequelize documentation, and I was unsure whether there was a way to remove a primary key constraint on a column.

Here is the most relevant link: http://docs.sequelizejs.com/en/latest/docs/migrations/#changecolumntablename-attributename-datatypeoroptions-options

like image 593
Darthpepper Avatar asked Mar 15 '26 05:03

Darthpepper


1 Answers

What worked for me was dropping to sql, not sure if I was doing something wrong but nothing else I tried seemed to work.

From: https://github.com/sequelize/sequelize/issues/313

up: function (queryInterface, Sequelize) {
    return queryInterface.sequelize.query('ALTER TABLE my_table DROP PRIMARY KEY');
}
like image 94
nbkap Avatar answered Mar 18 '26 21:03

nbkap



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!