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

Support configuration for skip checking of schema existence before switching #26

Closed
rpbaltazar opened this issue Apr 1, 2020 · 1 comment

Comments

@rpbaltazar
Copy link
Contributor

Steps to reproduce

Using postgresql, when running Apartment::Tenant.switch, before switching it check for the schema existence. In some cases, when there is a fair amount of load in the database, this can have an impact since it is yet another query being done.

Expected behavior

I think we should support a configuration that allows the apartment users to skip the schema existence and let them handle the errors on their end however they want.

Actual behavior

Currently there is no way to support this unless we monkeypatch the postgresql adapter in order to achieve it.

System configuration

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

postgresql - 12.0

  • Apartment version: 2.3.0

  • Apartment config (in config/initializers/apartment.rb or so):

    • use_schemas: true
  • Rails (or ActiveRecord) version: 6.0.2.1

  • Ruby version: 2.6

@rpbaltazar
Copy link
Contributor Author

As part of the migration running, it should be fine to check for the schema existence. Maybe show a warning message informing the user that there are schemas being referenced that do not exist in the database and show a proposed solution:
Either remove the record that references that non existent schema or create the schema.

@rpbaltazar rpbaltazar changed the title Support configuration for checking if schema exists before switching Support configuration for skip checking of schema existence before switching Apr 2, 2020
rpbaltazar added a commit that referenced this issue May 5, 2020
rpbaltazar added a commit that referenced this issue May 5, 2020
rpbaltazar added a commit that referenced this issue May 5, 2020
rpbaltazar added a commit that referenced this issue May 14, 2020
- [Resolves #42]
- [Resolves #26]
- [Resolves #41]
- [Resolves #37]
- Updated github actions configuration to run on PRs as well
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