When creating an object in a data migration, it attempts to set the primary key ID to be 1, instead of the next available key in the sequence. Simultaneous runs will version it up from 1 to 2, etc. but it should be checking the existing database where there are 40 records, and set the primary key to 41.
StandardError: An error has occurred, this and all later migrations canceled:
PG::UniqueViolation: ERROR: duplicate key value violates unique constraint "chip_architectures_pkey"
DETAIL: Key (id)=(1) already exists.
Is there something I need to do in configuration to get the migrations to recognize the common primary key authority like it would in regular migration files?
I'm having to add a hack to manually version up the id when creating an object:
id: Model.maximum(:id).to_i.next
It seems that I shouldn't need to do this and it should be assigned automatically.
Apologies. This was due to a special circumstance and not related to the gem. I was seeding with static primary and foreign keys, and that created the sequence table to become out of sync.
When creating an object in a data migration, it attempts to set the primary key ID to be 1, instead of the next available key in the sequence. Simultaneous runs will version it up from 1 to 2, etc. but it should be checking the existing database where there are 40 records, and set the primary key to 41.
Is there something I need to do in configuration to get the migrations to recognize the common primary key authority like it would in regular migration files?
I'm having to add a hack to manually version up the id when creating an object:
id: Model.maximum(:id).to_i.next
It seems that I shouldn't need to do this and it should be assigned automatically.