class MultitenancyTools::SchemaDestroyer

{SchemaDestroyer} can be used to destroy a PostgreSQL schema.

@example

destroyer = MultitenancyTools::SchemaDestroyer.new('schema name')
destroyer.destroy

Public Class Methods

new(schema, connection = ActiveRecord::Base.connection) click to toggle source

@param schema [String] schema name @param connection [ActiveRecord::ConnectionAdapters::PostgreSQLAdapter] connection adapter

# File lib/multitenancy_tools/schema_destroyer.rb, line 10
def initialize(schema, connection = ActiveRecord::Base.connection)
  @connection = connection
  @schema = @connection.quote_table_name(schema)
end

Public Instance Methods

destroy() click to toggle source

Drops the schema.

# File lib/multitenancy_tools/schema_destroyer.rb, line 16
def destroy
  @connection.drop_schema(@schema)
end