I had to put execute
into one table migration. It looks like this:
class CreateFoos < ActiveRecord::Migration
def up
create_table :items do |t|
t.integer :bar
end
execute("GRANT SELECT ON items TO otheruser;")
end
def down
drop_table :items
end
end
This works well, but db/schema.rb
file, which should be authority for database creation, is missing that line with execute
command.
Is there something I'm missing or this is default behavior when schema.rb
is generated?
I can bypass this issue by simply ignoring schema.rb
and generating tables with rake db:migrate
when deploying, but I saw recommendations to avoid doing so.
Any ideas?