app/models/user.rb
def create_schema(schema, role = nil)
    in_database(as: :superuser) do |database|
      if role
        database.run(%Q{CREATE SCHEMA \"#{schema}\" AUTHORIZATION "#{role}"})
      else
        database.run(%Q{CREATE SCHEMA \"#{schema}\"})
      end
    end
  rescue Sequel::DatabaseError => e
    raise unless e.message =~ /schema .* already exists/
  end
# Attempts to create a new database schema
# Does not raise exception if the schema already exists
Attempts to create a new database schema
Does not raise exception if the schema already exists
Attempts to create a new database schema Does not raise exception if the schema already exists
def create_schema(schema, role = nil)
    in_database(as: :superuser) do |database|
      if role
        database.run(%Q{CREATE SCHEMA \"#{schema}\" AUTHORIZATION "#{role}"})
      else
        database.run(%Q{CREATE SCHEMA \"#{schema}\"})
      end
    end
  rescue Sequel::DatabaseError => e
    raise unless e.message =~ /schema .* already exists/
  end
def create_schema ( schema , role = nil ) in_database ( as : :superuser ) do | database | if role database . run ( %Q{CREATE SCHEMA \"#{schema}\" AUTHORIZATION "#{role}"} ) else database . run ( %Q{CREATE SCHEMA \"#{schema}\"} ) end end rescue Sequel :: DatabaseError => e raise unless e . message =~ / schema .* already exists / end
Attempts to create a new database schema
Does not raise exception if the schema already exists
Attempts to create a new database schema Does not raise exception if the schema already exists
schema
role