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

error running db:seed task #86

Closed
pedrorgomes opened this issue Jul 8, 2020 · 5 comments · Fixed by #87
Closed

error running db:seed task #86

pedrorgomes opened this issue Jul 8, 2020 · 5 comments · Fixed by #87
Labels
bug Something isn't working

Comments

@pedrorgomes
Copy link

pedrorgomes commented Jul 8, 2020

Steps to reproduce

rails db:drop db:create db:migrate db:seed

Expected behavior

(truncated)
[WARNING] - The list of tenants to migrate appears to be empty. This could mean a few things:

      1. You may not have created any, in which case you can ignore this message
      2. You've run `apartment:migrate` directly without loading the Rails environment
        * `apartment:migrate` is now deprecated. Tenants will automatically be migrated with `db:migrate`

    Note that your tenants currently haven't been migrated. You'll need to run `db:migrate` to rectify this.

Seeding myapp_development_mygroup tenant

Actual behavior

(truncated)
[WARNING] - The list of tenants to migrate appears to be empty. This could mean a few things:

      1. You may not have created any, in which case you can ignore this message
      2. You've run `apartment:migrate` directly without loading the Rails environment
        * `apartment:migrate` is now deprecated. Tenants will automatically be migrated with `db:migrate`

    Note that your tenants currently haven't been migrated. You'll need to run `db:migrate` to rectify this.

Creating myapp_development_mygroup tenant
Error while creating tenant myapp_development_mygroup: Mysql2::Error: Can't create database 'myapp_development_mygroup'; database exists
Seeding myapp_development_mygroup tenant

(Seems like the application tries to create a database before running the seed command.)

System configuration

  • Database: Mysql 8.0.20

  • Apartment version: 2.7.1

  • Apartment config (in config/initializers/apartment.rb or so): #config.use_schemas = true (line is commented)

  • Rails (or ActiveRecord) version: 6.0.3.2

  • Ruby version: 2.7.1

I'm getting an error while running db:seed. It looks like the application tries to create a database before running the seed command. Everything runs ok at version 2.7.0

Due to this commit:
b6af077
apartment.zip

@rpbaltazar
Copy link
Contributor

Thank you for reporting, Will be addressing this issue over the weekend

@rpbaltazar
Copy link
Contributor

can you please paste your apartment.rb file in here in the ticket?
I have tried to replicate the scenario that you're describing and can't seem to be able to reproduce it:
https://github.com/rails-on-services/rails-6-demo/tree/rails-app-using-mysql

@rpbaltazar rpbaltazar added the bug Something isn't working label Jul 12, 2020
@rpbaltazar rpbaltazar linked a pull request Jul 12, 2020 that will close this issue
@pedrorgomes
Copy link
Author

pedrorgomes commented Jul 14, 2020

@rpbaltazar I have attached the apartment.rb file to my first post

@rpbaltazar
Copy link
Contributor

@pedrorgomes I'm having some issue reproducing your error. It's either a configuration problem on your app or on my demo. That being said, in order for me to help you further, you can create a simple repo with the problem happening that i can checkout and debug or we can try to jump on a sharing screen session where you show me the project setup and we do a bit of testing against the apartment itself.

rpbaltazar added a commit that referenced this issue Jul 17, 2020
@rpbaltazar
Copy link
Contributor

I commented on the PR, but i meant to write it here.
Without being able to replicate the actual reported bug, this (#87) is the best i can do at the moment. I'll close the 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. Feel free to test against the development branch and if the problem still persists, let me know and we'll try to sort it out.

rpbaltazar added a commit that referenced this issue Jul 17, 2020
rpbaltazar added a commit that referenced this issue Dec 16, 2020
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
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants