Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
刚刚通过(Setting.delete_all)删除了我所有的模型表。但是当我创建一个新设置时,它从 id 12 开始。如何删除“已删除设置”的 id?我想删除所有内容,以便在创建新设置时从 setting/1 开始。
帮助,谢谢:)
您将需要删除您的表,然后使用迁移重新生成它:
要删除表:
rake db:migrate:down VERSION="20130910082232" #replace with version no. of your table migration
然后再次创建它:
rake db:migrate:up VERSION="20130910082232" #replace with version no. of your table migration