Class: Apartment::Adapters::PostgresqlAdapter

Inherits:
AbstractAdapter show all
Defined in:
lib/apartment/adapters/postgresql_adapter.rb

Overview

Default adapter when not using Postgresql Schemas

Direct Known Subclasses

JDBCPostgresqlAdapter

Instance Attribute Summary

Attributes inherited from AbstractAdapter

#default_tenant

Instance Method Summary collapse

Methods inherited from AbstractAdapter

#create, #current, #current_database, #current_tenant, #each, #initialize, #process, #process_excluded_models, #reset, #seed_data, #switch, #switch!

Constructor Details

This class inherits a constructor from Apartment::Adapters::AbstractAdapter

Instance Method Details

#drop(tenant) ⇒ Object


18
19
20
21
22
23
24
# File 'lib/apartment/adapters/postgresql_adapter.rb', line 18

def drop(tenant)
  # Apartment.connection.drop_database note that drop_database will not throw an exception, so manually execute
  Apartment.connection.execute(%{DROP DATABASE "#{tenant}"})

rescue *rescuable_exceptions
  raise TenantNotFound, "The tenant #{tenant} cannot be found"
end