Hello everyone!
I have a table, "posts". And I want to start the id from 1000. Is that possible? Do I need a migration?
Thank your for your help!
Hello everyone!
I have a table, "posts". And I want to start the id from 1000. Is that possible? Do I need a migration?
Thank your for your help!
What database? If it’s mysql, you can use alter table like this:
ALTER TABLE t2 AUTO_INCREMENT = *value*;
-Bill
Guillaume Loader wrote:
Yes I know but with rails we never change the Db manually right?? We use migrations?
Uhh, I wouldn't say never. If you want to do it with a migration you will just have to execute the sql from the migration. Afaik, there is no special way to do this in a migration.
http://api.rubyonrails.org/classes/ActiveRecord/ConnectionAdapters/DatabaseStatements.html#M001887
-Bill
Guillaume Loader wrote: