class Sizes < ActiveRecord::Migration
def self.up
create_table :sizes do |t|
t.integer :size, :null => false
end
end
def self.down
drop_table :sizes
end
end
class Sizes < ActiveRecord::Migration
def self.up
Size.create(:id => 1, :size => 5)
Size.create(:id => 2, :size => 10)
end
def self.down
Size.delete_all
end
end
While trying to populate the db using the command rake db:migrate and i got the following output
select * from sizes;
id size
1 5
2 10
After I rollback the entire tables from db using the command called rake db:rollback. Once again I re-populated the db and now it seems to be the following
select * from sizes;
id size
3 5
4 10
I don’t want the primary key to change, how do I stop specifying the auto increment capability or specify the ability to associate a hard-coded primary key id, so that it remains the same.
Try this
Hope this helps