Skip to content

Instantly share code, notes, and snippets.

@paulsturgess
Created February 27, 2013 19:49
Show Gist options
  • Star 18 You must be signed in to star a gist
  • Fork 7 You must be signed in to fork a gist
  • Save paulsturgess/5051080 to your computer and use it in GitHub Desktop.
Save paulsturgess/5051080 to your computer and use it in GitHub Desktop.
Reset postgres primary key index using Rails
$ ActiveRecord::Base.connection.reset_pk_sequence!('table_name')

If you need the table names:

$ ActiveRecord::Base.connection.tables
=> ["accounts", "assets", ...]
@Rukosenpa
Copy link

2021, here for get help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment