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

Use a transaction for Apartment::Tenant.create #66

Closed
betelgeuse opened this issue Jun 10, 2020 · 1 comment · Fixed by #69
Closed

Use a transaction for Apartment::Tenant.create #66

betelgeuse opened this issue Jun 10, 2020 · 1 comment · Fixed by #69
Labels
enhancement New feature or request waiting feedback

Comments

@betelgeuse
Copy link

Steps to reproduce

  1. Have tenant creating fail in the middle (by missing functions for example)

Expected behavior

  1. Nothing gets created in the schema

Actual behavior

  1. You get leftover objects

As with PostgreSQL DDL is transaction safe, the schema creation should be wrapped with a transaction.

System configuration

  • Database: PostgreSQL 10

  • Apartment version: 2.6.1

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

    • use_schemas: true
    • persistent_schemas: %w[shared_extensions]
  • Rails (or ActiveRecord) version: 6.0.2.1

  • Ruby version: 2.7.0

@rpbaltazar rpbaltazar added the enhancement New feature or request label Jun 12, 2020
@rpbaltazar
Copy link
Contributor

Do you have an example of a broken scenario that i can use to draft my tests around?

@rpbaltazar rpbaltazar linked a pull request Jun 14, 2020 that will close this issue
rpbaltazar added a commit that referenced this issue Dec 16, 2020
Prepare Release - 2.8.0

- Resolves #98 - Trying to generate an automatic changelog - #99
- Resolves #86 - Fixes seeding errors - #87
- Resolves #66 - Uses a transaction to create a tenant - #69
- Resolves #121 - Relaxes dependencies to allow rails 6.1 - #122
- Resolves #123 - When tests run in a transaction, new tenants in tests fail to create - #124
- Reverted unsafe initializer - #118
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request waiting feedback
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants