I am attempting to create a table in rails.. I need to be able to set the id's to data that's coming in because I have three (or more) sources, and their ID's must match.
I'm setting the ID's manually, based on data I get in.
When I create the table with a migration, I get the message "will create implicit sequence" I don't want this to happen... How do I avoid it?
I know why it's always there.. but sometimes we need customization no? :)
ActiveRecord make the :primary_key column auto_increment by default. Maybe you have to create the primary key by yourself if you don't want it auto_increment.
create_table :table_name, :id => false do |t|
t.integer :id
t.timestamps
end
ActiveRecord::Base.connection.execute("ALTER TABLE table_name ADD PRIMARY KEY (id)")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With