Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR RUBY

rails start id to 1000

create_table :orders do |t|
  t.integer  :price
  # other stuff
end

# for Postgres
execute "SELECT setval('orders_id_seq', 1000)"

# and for mysql ...
execute "ALTER TABLE products AUTO_INCREMENT = 1000"
 
PREVIOUS NEXT
Tagged: #rails #start #id
ADD COMMENT
Topic
Name
2+6 =