Search code examples
ruby-on-railsrubysqliteruby-on-rails-4sqlite3-ruby

SQL delete all id paths of a model table


Just deleted my all my model tables by (Setting.delete_all). But when I create a new setting it starts from id 12. How do i delete the ids of the "deleted settings"? I want to delete everything so that I start from setting/1 when I create a new setting.

Help, thanks :)


Solution

  • You will need to drop your table and then regenerate it using migration:

    To drop table:

    rake db:migrate:down VERSION="20130910082232"    #replace with version no. of your table migration
    

    Then create it again:

    rake db:migrate:up VERSION="20130910082232"      #replace with version no. of your table migration