diff --git a/lib/apartment/active_record/postgresql_adapter.rb b/lib/apartment/active_record/postgresql_adapter.rb index ef878111..5426840f 100644 --- a/lib/apartment/active_record/postgresql_adapter.rb +++ b/lib/apartment/active_record/postgresql_adapter.rb @@ -8,6 +8,8 @@ module Apartment::PostgreSqlAdapterPatch def default_sequence_name(table, _column) res = super + res.delete!('"') # if rescued in super_method, trim leading and trailing quotes + schema_prefix = "#{Apartment::Tenant.current}." default_tenant_prefix = "#{Apartment::Tenant.default_tenant}." diff --git a/spec/support/apartment_helpers.rb b/spec/support/apartment_helpers.rb index 0641b13f..82550ae7 100644 --- a/spec/support/apartment_helpers.rb +++ b/spec/support/apartment_helpers.rb @@ -25,7 +25,7 @@ def drop_schema(schema) end # Use this if you don't want to import schema.rb etc... but need the postgres schema to exist - # basically for speed purposes + # basically for speed purposes. def create_schema(schema) ActiveRecord::Base.connection.execute("CREATE SCHEMA #{schema}") end