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 Method Summary collapse

Methods inherited from AbstractAdapter

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

Constructor Details

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

Instance Method Details

#drop(tenant) ⇒ Object



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

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 DatabaseNotFound, "The tenant #{tenant} cannot be found"
end