Created
January 22, 2015 02:49
-
-
Save AndreiRailean/d2134dc38258f2d6e3bb to your computer and use it in GitHub Desktop.
Fix Rails Sequences
This file contains hidden or 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
# Run this when your sequences get out of whack | |
# Can happen after a botched database restore | |
# Tested with postgres | |
ActiveRecord::Base.connection.tables.each do |table| | |
ActiveRecord::Base.connection.reset_pk_sequence!(table) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment