Skip to content

Instantly share code, notes, and snippets.

@aruprakshit
Forked from paulsturgess/reset_primary_key.md
Last active August 29, 2015 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aruprakshit/f3b22ae0c86e2f88c5df to your computer and use it in GitHub Desktop.
Save aruprakshit/f3b22ae0c86e2f88c5df to your computer and use it in GitHub Desktop.
$ ActiveRecord::Base.connection.reset_pk_sequence!('table_name')

If you need the table names:

$ ActiveRecord::Base.connection.tables
=> ["accounts", "assets", ...]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment