I've seen we can avoid using a SEQUENCE on the object's ID by doing this:
create_table :table_name, :id => false do |t|
t.integer :id
t.timestamps
end
But, if my table is already created and I want to remove the "CREATE SEQUENCE table_name_id_seq" from the schema, how can I do this without dropping the table? If impossible it will be ok I guess but I did not want to loose my table content.
You'll have to use raw SQL to do this. Something like the following:
def up
ActiveRecord::Base.connection.execute "DROP SEQUENCE table_name_id_seq"
end
http://www.postgresql.org/docs/9.1/static/sql-dropsequence.html
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