diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2015-10-07 12:30:10 +0200 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2015-10-07 23:32:14 +0200 |
commit | 85c6a3743abe5683c2317f1957a9f047ad2b4b8e (patch) | |
tree | df5190eeabba1f12024efdb0abc270efc7642167 /lib/gitlab/database.rb | |
parent | c670f0736648a4dbd558d2f41eea33f773dee3a6 (diff) | |
download | gitlab-ce-85c6a3743abe5683c2317f1957a9f047ad2b4b8e.tar.gz |
Added methods for detecting MySQL/PostgreSQL
These two methods remove the need for manually going into
ActiveRecord::Base.connection all over the place.
Diffstat (limited to 'lib/gitlab/database.rb')
-rw-r--r-- | lib/gitlab/database.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/gitlab/database.rb b/lib/gitlab/database.rb new file mode 100644 index 00000000000..741a52714ac --- /dev/null +++ b/lib/gitlab/database.rb @@ -0,0 +1,11 @@ +module Gitlab + module Database + def self.mysql? + ActiveRecord::Base.connection.adapter_name.downcase == 'mysql' + end + + def self.postgresql? + ActiveRecord::Base.connection.adapter_name.downcase == 'postgresql' + end + end +end |