Closed stap780 closed 2 months ago
as i understand the problem is that file schema.rb have records - create_schema "insales22810" and another
I don't understand - my file schema.rb need to have information about create_schema ? or something wrong with setup?
and i use - bundle exec rake db:schema:dump - to update db/schema.rb
@stap780 the create schema
lines in the schema.rb were added by Rails, not by Apartment. We have used a similar workaround to this to have this not occur https://github.com/rails-on-services/apartment/pull/276
I'm looking to include this workaround in the next release of the Apartment gem
@mnovelo I right understand that better is to wait while you upgrade gem?
@mnovelo thanks for adding this fix. Would be great if you could include this in the next release.
Hello,
i try create tenant and have error (look attachment).
Loading development environment (Rails 7.1.4) User Pluck (1.2ms) SELECT "public"."users"."subdomain" FROM "public"."users" Available Tenants: [nil, "teletri", "test2", "ketago", "support_ketago_com"] Use
st 'tenant'
to switch tenants &tenant_list
to see list [1] [development][public] pry(main)> Apartment::Tenant.create('test1234') (12.5ms) BEGIN; CREATE SCHEMA "test1234"; COMMIT; (3.4ms) CREATE SCHEMA "insales22810" ActiveRecord::StatementInvalid: PG::DuplicateSchema: ERROR: schema "insales22810" already existsfrom /Users/administrator/.rvm/gems/ruby-3.2.0/gems/activerecord-7.1.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:55:in `exec' Caused by PG::DuplicateSchema: ERROR: schema "insales22810" already exists
from /Users/administrator/.rvm/gems/ruby-3.2.0/gems/activerecord-7.1.4/lib/active_record/connection_adapters/postgresql/database_statements.rb:55:in `exec' [2] [development][public] pry(main)> exit
Database: (Tell us what database and its version you use.) Postgresql 9.5
Apartment version: 3.1.0
Apartment config (in
config/initializers/apartment.rb
or so):use_schemas
: (true
orfalse
) defaultRails (or ActiveRecord) version: 7.1.4
Ruby version: 3.2.0