-
Notifications
You must be signed in to change notification settings - Fork 168
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
Conversation
@ahorek mind you try using this branch in your setup and see if it resolves it? |
yeah, I can confirm this PR is enough to fix #71 (comment) on my setup thanks! |
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? |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you are totally right
There was a problem hiding this comment.
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
…s unless there is a default tenant
3b7b147
to
658312e
Compare
… default tenant if present
@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. |
sure, no problem |
can you try with this version? my test app also seems to be working. |
works for me too |
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
No description provided.