With autogenerate false primary_key is still auto incrementing

I have this primary key field which was set in my migration like this:

          add(:rev_id, :bigserial, primary_key: true)

It’s auto incremented and I dont want it to be auto incremented so I wrote a migration and change it like this:

           modify(:rev_id, :integer, primary_key: true)

I changed it from bigserial to integer. And in my schema I set it like this:

     @primary_key {:revision_id, :integer, autogenerate: false}

But when I test it its still auto incrementing.
Am I missing something?

its seems like removing the rev_id and then creating it again solved the problem

1 Like

Specifically because it’s the DB that does the autoincrementing, not Ecto, and it needed to be told not to do that via a migration or recreation. :slight_smile:

1 Like