i create a new model(User) and create a new record (User.create(attributes)) in oracle when i check User.find 1 in console it gives record not found error
when i try User.find(:first).id --> 10000
how to change this starting id into 1 ....
i create a new model(User) and create a new record (User.create(attributes)) in oracle when i check User.find 1 in console it gives record not found error
when i try User.find(:first).id --> 10000
how to change this starting id into 1 ....
The following lines are in oracle_adapter.rb
def create_table(name, options = {}) #:nodoc: super(name, options) seq_name = options[:sequence_name] || "#{name}_seq" execute "CREATE SEQUENCE #{seq_name} START WITH 10000" unless options[:id] == false end
I don't know why they decided to hard-code the 10000 in there. It would be nice if you could override it. I suggest submitting an enhancement request to the ruby-oci8 maintainer. A simple patch would be
def create_table(name, options = {}) #:nodoc: super(name, options) seq_name = options[:sequence_name] || "#{name}_seq" start_num = options[:start_with] || 10000 execute "CREATE SEQUENCE #{seq_name} START WITH #{start_num}" unless options[:id] == false end
assuming the class chain starting with ActiveRecord::Migration passes all the options through. In the mean time you could monkey patch the class with the above method yourself.
Mark.
I don't know why they decided to hard-code the 10000 in there. It would be nice if you could override it. I suggest submitting an enhancement request to the ruby-oci8 maintainer. A simple patch would be
def create_table(name, options = {}) #:nodoc: super(name, options) seq_name = options[:sequence_name] || "#{name}_seq" start_num = options[:start_with] || 10000 execute "CREATE SEQUENCE #{seq_name} START WITH #{start_num}" unless options[:id] == false end
Mark.
thanks