class Apartment::Adapters::JDBCPostgresqlAdapter
Default adapter when not using Postgresql Schemas
def create_tenant(tenant)
def create_tenant(tenant) # There is a bug in activerecord-jdbcpostgresql-adapter (1.2.5) that will cause # an exception if no options are passed into the create_database call. Apartment.connection.create_database(environmentify(tenant), { :thisisahack => '' }) rescue *rescuable_exceptions raise DatabaseExists, "The tenant #{environmentify(tenant)} already exists." end
def multi_tenantify(tenant)
Return a new config that is multi-tenanted
def multi_tenantify(tenant) @config.clone.tap do |config| config[:url] = "#{config[:url].gsub(/(\S+)\/.+$/, '\1')}/#{environmentify(tenant)}" end end
def rescue_from
def rescue_from ActiveRecord::JDBCError end