lib/hanami/model/migrator/mysql_adapter.rb in hanami-model-1.0.0.beta1 vs lib/hanami/model/migrator/mysql_adapter.rb in hanami-model-1.0.0.beta2
- old
+ new
@@ -17,11 +17,11 @@
'https://github.com/hanami/model/issues/250'.freeze
# @since 0.4.0
# @api private
def create
- new_connection(global: true).run %(CREATE DATABASE #{database};)
+ new_connection(global: true).run %(CREATE DATABASE `#{database}`;)
rescue Sequel::DatabaseError => e
message = if e.message.match(/database exists/) # rubocop:disable Performance/RedundantMatch
DB_CREATION_ERROR
else
e.message
@@ -31,10 +31,10 @@
end
# @since 0.4.0
# @api private
def drop
- new_connection(global: true).run %(DROP DATABASE #{database};)
+ new_connection(global: true).run %(DROP DATABASE `#{database}`;)
rescue Sequel::DatabaseError => e
message = if e.message.match(/doesn\'t exist/) # rubocop:disable Performance/RedundantMatch
"Cannot find database: #{database}"
else
e.message