aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/proxy_object.rb
diff options
context:
space:
mode:
authorJohn Hawthorn <john@hawthorn.email>2019-07-29 08:40:57 -0700
committerJohn Hawthorn <john@hawthorn.email>2019-07-29 08:40:57 -0700
commit69700c9ee760c5880fc80af70a89b42bb791cf98 (patch)
treecdb954cd1ca7ea406be05278921a01fd6e0d97a8 /activesupport/lib/active_support/proxy_object.rb
parent2e6d9af6c8b9900481dabfca685b3e335c2f27aa (diff)
downloadrails-69700c9ee760c5880fc80af70a89b42bb791cf98.tar.gz
rails-69700c9ee760c5880fc80af70a89b42bb791cf98.tar.bz2
rails-69700c9ee760c5880fc80af70a89b42bb791cf98.zip
Move DatabaseAlreadyExists detection to DB adapter
Previously it was the responsibility of the database tasks to translate the invalid statement from creating a duplicate database into an ActiveRecord::Tasks::DatabaseAlreadyExists error. It's actually easier for us to do this detection inside of the adapter, where we already do a case statement on the return code to translate the error. This commit introduces ActiveRecord::DatabaseAlreadyExists, a subclass of StatementInvalid, and updates both AbstractMysqlAdapter and PostgresqlAdapter to return this more specific exception in that case. Because this is a subclass of the old exception, StatementInvalid, it should be backwards compatible with any code expecting that from create_database. This works for both create_database and exectute("CREATE DATABASE")
Diffstat (limited to 'activesupport/lib/active_support/proxy_object.rb')
0 files changed, 0 insertions, 0 deletions