First Post(gresql)!
Update: DB Table permissions don’t belong in migrations and aren’t added to schema.rb. I’ve added them to the bootstrap rake tasks.
I’m a postgresql newbie and suspect there will be a few more of us now that Oracle has brought Mysql. I’ve heard Ruby on Rails is a bit mysql centric. I know I have been for a few years. So I think it’s time to dust off the old blog and put it to use.
Postgresql permissions on a table appear to be removed when the table is removed.
I’ve added the following Rails migration to grant an outside user access to a single table in the schema:
class SetupRecipePerms < ActiveRecord::Migration
def self.up
ActiveRecord::Base.connection.execute "grant select,update,insert,delete on recipes to eggs_recipes;"
if ActiveRecord::Base.connection.adapter_name == 'PostgreSQL'
ActiveRecord::Base.connection.execute "grant select,update on sequence recipes_id_seq to eggs_recipes;"
end
end
...
This doesn’t get added to schema.rb so doesn’t get run by “rake db:schema:load”
Will it get added to schema.rb if I’m running postgres locally (making it db dependent)?
How else might I add permissions as part of the standard Rails db setup?
