Skip to content
Permalink
Browse files

Monkey-patching BLACKLISTED_STATEMENTS in the Apartment::Postgres ada…

…pter so we don't carry over some 'CREATE SCHEMA' instructions, since Apartment runs the `create_schema_command` beforehand anyway.
  • Loading branch information...
Aquaj authored and pquintrie committed Feb 25, 2019
1 parent 99c8300 commit f4f2e3aef229a7282644f974fbf559f2d8d08489
Showing with 10 additions and 0 deletions.
  1. +10 −0 config/initializers/apartment.rb
@@ -105,6 +105,16 @@ def connect_to_new(tenant = nil)
# raise TenantNotFound, "One of the following schema(s) is invalid: \"#{tenant}\" #{full_search_path}"
end
end

class PostgresqlSchemaFromSqlAdapter < PostgresqlSchemaAdapter
PSQL_DUMP_BLACKLISTED_STATEMENTS= [
/SET search_path/i, # overridden later
/SET lock_timeout/i, # new in postgresql 9.3
/SET row_security/i, # new in postgresql 9.5
/SET idle_in_transaction_session_timeout/i, # new in postgresql 9.6
/CREATE SCHEMA/i,
]
end
end
end

0 comments on commit f4f2e3a

Please sign in to comment.
You can’t perform that action at this time.