diff options
author | Rafael França <rafaelmfranca@gmail.com> | 2017-08-11 15:55:10 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-11 15:55:10 -0400 |
commit | 043f83fed3ff454a4b3735b3388541b9583bb4c4 (patch) | |
tree | f1a0f98533d81bb76e0563db05ff769ea5c0badd /activerecord/lib | |
parent | 72e311c3dbf3bf7d7684176680ae0badf4c2c3cc (diff) | |
parent | e47fbba7d7ad7647840836ebd709e4169230d35a (diff) | |
download | rails-043f83fed3ff454a4b3735b3388541b9583bb4c4.tar.gz rails-043f83fed3ff454a4b3735b3388541b9583bb4c4.tar.bz2 rails-043f83fed3ff454a4b3735b3388541b9583bb4c4.zip |
Merge pull request #30193 from zverok/robust-postgres-duplicate-db
More robust PostgreSQL database duplication check
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/tasks/postgresql_database_tasks.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/tasks/postgresql_database_tasks.rb b/activerecord/lib/active_record/tasks/postgresql_database_tasks.rb index a2e74efc2b..955b1d4e94 100644 --- a/activerecord/lib/active_record/tasks/postgresql_database_tasks.rb +++ b/activerecord/lib/active_record/tasks/postgresql_database_tasks.rb @@ -22,7 +22,7 @@ module ActiveRecord configuration.merge("encoding" => encoding) establish_connection configuration rescue ActiveRecord::StatementInvalid => error - if /database .* already exists/.match?(error.message) + if error.cause.is_a?(PG::DuplicateDatabase) raise DatabaseAlreadyExists else raise |