Skip to content

Instantly share code, notes, and snippets.

@lauborges
Last active January 3, 2016 17:59
Show Gist options
  • Save lauborges/8499057 to your computer and use it in GitHub Desktop.
Save lauborges/8499057 to your computer and use it in GitHub Desktop.
Fix - postgresql duplicate key violates unique constraint
ActiveRecord::Base.connection.reset_pk_sequence!('entities')
ActiveRecord::Base.connection.tables.map do |model|
ActiveRecord::Base.connection.reset_pk_sequence!(model.downcase)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment