Skip to content

Instantly share code, notes, and snippets.

@matthaliski
Created September 29, 2014 14:42
Show Gist options
  • Save matthaliski/419faf08c77d258d4224 to your computer and use it in GitHub Desktop.
Save matthaliski/419faf08c77d258d4224 to your computer and use it in GitHub Desktop.
Fix for -> PG::Error: ERROR: duplicate key value violates unique constraint
# 'users' is whatever table you need to fix.
# http://stackoverflow.com/questions/13670235/after-importing-data-in-postgresql-duplicate-key-value-violates-unique-constrai

ActiveRecord::Base.connection.reset_pk_sequence!('users')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment