module PgSaurus::Migration::SetRoleMethod

Wrap original `exec_migration` to run migration with set postgresql role. If config.ensure_role_set=true but no role is set for the migration, then an exception is raised.

Attributes

role[R]

Public Class Methods

keep_default_role() click to toggle source

Prevents raising exception when ensure_role_set=true and no role is set.

# File lib/pg_saurus/migration/set_role_method.rb, line 20
def keep_default_role
  @keep_default_role = true
end
keep_default_role?() click to toggle source

Was keep_default_role called for the migration?

@return [Boolean]

# File lib/pg_saurus/migration/set_role_method.rb, line 27
def keep_default_role?
  @keep_default_role
end
set_role(role) click to toggle source

Set role

@param role [String]

# File lib/pg_saurus/migration/set_role_method.rb, line 15
def set_role(role)
  @role = role
end

Public Instance Methods

role() click to toggle source

Get role

# File lib/pg_saurus/migration/set_role_method.rb, line 34
def role
  self.class.role
end