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

[Resolves #86] error running db seed task #87

Merged
merged 2 commits into from
Jul 17, 2020

Conversation

rpbaltazar
Copy link
Contributor

  • ensure listed tenants are created before trying to migrate them or seed them

@rpbaltazar rpbaltazar changed the title [#86] error running db seed task [Resolves #86] error running db seed task Jul 12, 2020
@rpbaltazar rpbaltazar force-pushed the 86-error-running-db-seed-task branch from aa21143 to 83aa696 Compare July 12, 2020 08:56
@rpbaltazar rpbaltazar linked an issue Jul 12, 2020 that may be closed by this pull request
@rpbaltazar rpbaltazar force-pushed the 86-error-running-db-seed-task branch from 83aa696 to 4dc134e Compare July 16, 2020 17:06
@rpbaltazar
Copy link
Contributor Author

Without being able to replicate the actual reported bug, this is the best i can do at the moment. I'll close the associated issue as well. If this is still a problem, then we'll need to investigate further how to find out the source of the problem

@rpbaltazar rpbaltazar force-pushed the 86-error-running-db-seed-task branch from 09364b5 to 9a60f80 Compare July 17, 2020 05:41
@rpbaltazar rpbaltazar merged commit c621a87 into development Jul 17, 2020
@rpbaltazar rpbaltazar deleted the 86-error-running-db-seed-task branch July 17, 2020 07:39
@louim
Copy link

louim commented Oct 8, 2020

Hey! I was testing with the development branch, and I found that I wasn't able to migrate the tenants anymore. I narrowed it down to this PR. Here is the relevant result of running rails db:migrate with the development branch. It fails at trying to create the first schema (because it exists), and then the transaction is in an aborted state and nothing else can be done:

Tried to create already existing tenant: Error while creating tenant fc622aee-dd04-4845-a81d-c580dabd72f3_development: PG::DuplicateSchema: ERROR:  schema "fc622aee-dd04-4845-a81d-c580dabd72f3" already exists
Migrating fc622aee-dd04-4845-a81d-c580dabd72f3 tenant
rails aborted!
ActiveRecord::StatementInvalid: PG::InFailedSqlTransaction: ERROR:  current transaction is aborted, commands ignored until end of transaction block
/Users/louim/work/fx-api/bin/rails:9:in `<top (required)>'
/Users/louim/work/fx-api/bin/spring:15:in `<top (required)>'
bin/rails:3:in `load'
bin/rails:3:in `<main>'

Caused by:
PG::InFailedSqlTransaction: ERROR:  current transaction is aborted, commands ignored until end of transaction block
/Users/louim/work/fx-api/bin/rails:9:in `<top (required)>'
/Users/louim/work/fx-api/bin/spring:15:in `<top (required)>'
bin/rails:3:in `load'
bin/rails:3:in `<main>'

Caused by:
Apartment::TenantNotFound: One of the following schema(s) is invalid: "public" "public", "shared_extensions"
/Users/louim/work/fx-api/bin/rails:9:in `<top (required)>'
/Users/louim/work/fx-api/bin/spring:15:in `<top (required)>'
bin/rails:3:in `load'
bin/rails:3:in `<main>'

Caused by:
ActiveRecord::StatementInvalid: PG::InFailedSqlTransaction: ERROR:  current transaction is aborted, commands ignored until end of transaction block
/Users/louim/work/fx-api/bin/rails:9:in `<top (required)>'
/Users/louim/work/fx-api/bin/spring:15:in `<top (required)>'
bin/rails:3:in `load'
bin/rails:3:in `<main>'

Caused by:
PG::InFailedSqlTransaction: ERROR:  current transaction is aborted, commands ignored until end of transaction block
/Users/louim/work/fx-api/bin/rails:9:in `<top (required)>'
/Users/louim/work/fx-api/bin/spring:15:in `<top (required)>'
bin/rails:3:in `load'
bin/rails:3:in `<main>'

Caused by:
Apartment::TenantNotFound: One of the following schema(s) is invalid: "fc622aee-dd04-4845-a81d-c580dabd72f3" "public", "shared_extensions"
/Users/louim/work/fx-api/bin/rails:9:in `<top (required)>'
/Users/louim/work/fx-api/bin/spring:15:in `<top (required)>'
bin/rails:3:in `load'
bin/rails:3:in `<main>'

Caused by:
ActiveRecord::StatementInvalid: PG::InFailedSqlTransaction: ERROR:  current transaction is aborted, commands ignored until end of transaction block
/Users/louim/work/fx-api/bin/rails:9:in `<top (required)>'
/Users/louim/work/fx-api/bin/spring:15:in `<top (required)>'
bin/rails:3:in `load'
bin/rails:3:in `<main>'

Caused by:
PG::InFailedSqlTransaction: ERROR:  current transaction is aborted, commands ignored until end of transaction block
/Users/louim/work/fx-api/bin/rails:9:in `<top (required)>'
/Users/louim/work/fx-api/bin/spring:15:in `<top (required)>'
bin/rails:3:in `load'
bin/rails:3:in `<main>'
Tasks: TOP => apartment:migrate
(See full trace by running task with --trace)

I think Apartment::Tenant.create should probably handle the case that the tenant already exists. Or maybe a conditional method like Apartment::Tenant.create_if_not_exists?

@GaboFDC
Copy link
Contributor

GaboFDC commented Oct 8, 2020

Also not trying to bother, but just wondering, when will this be released? is there a schedule or something? jut wanted to be aware of the time frame. I know this is time you give from your own, so not pushing or anything like that.

rpbaltazar added a commit that referenced this pull request 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
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

error running db:seed task
3 participants