Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apartment::Tenant.create('tenant_name') - using schema.rb instead of pg_dump for creating new schemas #224

Open
DurairajC opened this issue Apr 12, 2023 · 0 comments

Comments

@DurairajC
Copy link

Apartment::Tenant.create('tenant_name') - using schema.rb instead of pg_dump for creating new schemas

Steps to reproduce

  1. change in apartment.rb file
    config.use_sql = true

  2. Run Apartment::Tenant.create('tenant_name')

Expected behavior

Use raw SQL dumps instead of schema.rb.

Actual behavior

Using schema.rb to generate tables.

Getting below issue
ActiveRecord::StatementInvalid (PG::UndefinedTable: ERROR: relation "table2" does not exist)
: CREATE TABLE "table1"

the "table2" that does not exist is created next to the "table1" in the schema.rb file.

System configuration

  • Database: (Tell us what database and its version you use.)
    psql (PostgreSQL) 11.13

  • Apartment version:
    ros-apartment (2.11.0)

  • Apartment config (in config/initializers/apartment.rb or so):
    config.tenant_names = ['tenant1','tenant2']
    config.use_schemas = true
    config.use_sql = true

  • Rails (or ActiveRecord) version:
    activerecord (5.2.2)

  • Ruby version:
    ruby 2.7.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant