[#112] Adapt database switches to use ChiliProject::Database

This commit is contained in:
Holger Just 2011-05-15 23:15:52 +02:00
parent 8279144073
commit d90102420d
2 changed files with 2 additions and 2 deletions

View File

@ -299,7 +299,7 @@ class User < Principal
# version. Exact matches will be given priority.
def self.find_by_login(login)
# force string comparison to be case sensitive on MySQL
type_cast = (ActiveRecord::Base.connection.adapter_name =~ /mysql/i) ? 'BINARY' : ''
type_cast = (ChiliProject::Database.mysql?) ? 'BINARY' : ''
# First look for an exact match
user = first(:conditions => ["#{type_cast} login = ?", login])
# Fail over to case-insensitive if none was found

View File

@ -3,7 +3,7 @@ class ChangeWikiContentsTextLimit < ActiveRecord::Migration
# Migrates MySQL databases only
# Postgres would raise an error (see http://dev.rubyonrails.org/ticket/3818)
# Not fixed in Rails 2.3.5
if ActiveRecord::Base.connection.adapter_name =~ /mysql/i
if ChiliProject::Database.mysql?
max_size = 16.megabytes
change_column :wiki_contents, :text, :text, :limit => max_size
change_column :wiki_content_versions, :data, :binary, :limit => max_size