Error in creating non primary auto-increment field

I want to declare a field(id) in table which is auto_increment but isn’t a primary key.
I was using add :id,:serial, null: false in the change method of the migration and it was working fine.
But then I updated the ecto pkg from 2.1.6 to 2.2.6 and the migration started to fail with error:

Incorrect table definition; there can be only one auto column and it must be defined as a key

The difference is that earlier a unique constraint UNIQUE KEY id (id) was added to the DDL and it is missing now.
I tried explicitly creating a unique index using create unique_index(:table_name, [:id]) but it still fails with same error.
How can I resolve it?