You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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.
The text was updated successfully, but these errors were encountered: