Skip to content

Commit

Permalink
Dashes in schema names with PostgresqlSchemaAdapter influitive#198
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathangreenberg committed Jan 8, 2015
1 parent 7ee251b commit 62a6d65
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/apartment/adapters/postgresql_adapter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def pg_dump_schema_migrations_data
# @return {String} patched raw SQL dump
#
def patch_search_path(sql)
search_path = "SET search_path = #{current}, #{default_tenant};"
search_path = "SET search_path = \"#{current}\", #{default_tenant};"

sql
.split("\n")
Expand Down
6 changes: 6 additions & 0 deletions spec/adapters/postgresql_adapter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ def tenant_names

it_should_behave_like "a generic apartment adapter"
it_should_behave_like "a schema based apartment adapter"

it 'allows for dashes in the schema name' do
expect { Apartment::Tenant.create('has-dashes') }.to_not raise_error
end

after { Apartment::Tenant.drop('has-dashes') if Apartment.connection.schema_exists? 'has-dashes' }
end

context "using connections" do
Expand Down

0 comments on commit 62a6d65

Please sign in to comment.