Last active
December 14, 2015 06:59
-
-
Save Ivor/5046702 to your computer and use it in GitHub Desktop.
PG duplicate key issue after importing pg dump.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#If you get this issue when trying to save to a recently imported postgres db. | |
#PG::Error: ERROR: duplicate key value violates unique constraint | |
#Run the following in your rails console. | |
ActiveRecord::Base.connection.tables.each do |t| | |
ActiveRecord::Base.connection.reset_pk_sequence!(t) | |
end;nil |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment