-
Notifications
You must be signed in to change notification settings - Fork 81
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
Can't create databases after you drop them #193
Comments
I think the problem is in https://github.com/TalentBox/sequel-rails/blob/master/lib/sequel_rails/railties/database.rake#L103 It tries to load the environment which (probably) calls I did verify that by monkeypatching the def connect(environment)
normalized_config = environment_for environment
unless (normalized_config.keys & %w[adapter url]).any?
raise "Database not configured.\n" \
'Please create config/database.yml or set DATABASE_URL in environment.'
end
begin
config_with_symbolized_keys = SequelRails.deep_symbolize_keys(normalized_config)
if normalized_config['url']
::Sequel.connect normalized_config['url'], config_with_symbolized_keys
else
::Sequel.connect config_with_symbolized_keys
end.tap { after_connect.call if after_connect.respond_to?(:call) }
rescue Sequel::DatabaseConnectionError => e
regex = /database "(?<database_name>\w+)" does not exist/
matches = e.message.match(regex)
if matches[:database_name].eql?(config_with_symbolized_keys[:database])
continue
else
raise e
end
end
end which makes things work:
|
Of course, I realized that if you |
Use |
I add this to
You can also check if |
I think it fixed in last release |
I'm pretty much it's because it will try to connect to the database specified in
config/database.yml
which will not exist since we just dropped it :)The text was updated successfully, but these errors were encountered: