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

[Fixes #61] db create is failed #76

Merged
merged 9 commits into from
Jun 25, 2020
Merged

Conversation

rpbaltazar
Copy link
Contributor

No description provided.

@rpbaltazar
Copy link
Contributor Author

@ahorek mind you try using this branch in your setup and see if it resolves it?

@rpbaltazar rpbaltazar linked an issue Jun 24, 2020 that may be closed by this pull request
@ahorek
Copy link

ahorek commented Jun 24, 2020

yeah, I can confirm this PR is enough to fix #71 (comment) on my setup

thanks!

@rpbaltazar
Copy link
Contributor Author

Waiting for the tests to pass and will prep a release tomorrow.

@@ -39,6 +39,8 @@ def initialize(config)
# Reset current tenant to the default_tenant
#
def reset
return if @default_tenant.nil?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the only reason for @default_tenant to be nil? Wouldn't it make more sense to not call reset on the appropriate places?

Copy link
Contributor Author

@rpbaltazar rpbaltazar Jun 24, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Independently of that, if default_tentant is nil, the mysql statement generated would be invalid

mysql> use ``
ERROR 1046 (3D000): No database selected

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, but default_tenant (the method) falls back on the configured default tenant. Which is why I think it was supposed to be a valid case to have @default_tenant to be nil.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rightly spotted. I meant default_tenant not @default_tenant. let me double check it still works on my test app

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you are totally right

Copy link
Contributor Author

@rpbaltazar rpbaltazar Jun 25, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, I've dug further into active record and for mysql it explicitly calls establish connection without database.
I can't see any other way around it.
Also we have a todo in the code base mentioning that public is a postgres specific, so I'd say it's safe to assume that there should not be a default to mysql

@rpbaltazar rpbaltazar force-pushed the 61-db-create-is-failed branch from 3b7b147 to 658312e Compare June 25, 2020 13:53
@rpbaltazar
Copy link
Contributor Author

rpbaltazar commented Jun 25, 2020

@ahorek sorry for the delay but some of the questions raised were very valid. I'm taking the chance to refactor how the default tenant logic works because that is part of the problem in this case.

I think i'm relatively close to finish to fix all the broken specs and then I'll ask you to try again.

@ahorek
Copy link

ahorek commented Jun 25, 2020

sure, no problem

@rpbaltazar
Copy link
Contributor Author

sure, no problem

can you try with this version? my test app also seems to be working.

@ahorek
Copy link

ahorek commented Jun 25, 2020

works for me too

@rpbaltazar rpbaltazar merged commit 2d7ab16 into development Jun 25, 2020
@rpbaltazar rpbaltazar deleted the 61-db-create-is-failed branch June 25, 2020 17:05
rpbaltazar added a commit that referenced this pull request Jun 26, 2020
Prepare Release - 2.7.0

# Enhancements

- [Resolves #70] Rake tasks define methods on main - #75
- Add database and schema to active record log. Configurable, defaults to false to keep current behavior - #55

# Bugfixes

- [Fixes #61] Fix database create in mysql - #76

# Chores

- Remove depracated tld_length config option: tld_length was removed in influitive#309, this configuration option doesn't have any effect now. - #72
- Using [diffend.io proxy](https://diffend.io) to safely check required gems
- Added [story branch](https://github.com/story-branch/story_branch) to the configuration
- Using travis-ci to run rubocop as well, replacing github actions: github actions do not work in fork's PRs
@rpbaltazar rpbaltazar mentioned this pull request Jun 26, 2020
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.

db:create is failed
3 participants