[#112] Adapt database switches to use ChiliProject::Database
This commit is contained in:
parent
8279144073
commit
d90102420d
@ -299,7 +299,7 @@ class User < Principal
|
|||||||
# version. Exact matches will be given priority.
|
# version. Exact matches will be given priority.
|
||||||
def self.find_by_login(login)
|
def self.find_by_login(login)
|
||||||
# force string comparison to be case sensitive on MySQL
|
# 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
|
# First look for an exact match
|
||||||
user = first(:conditions => ["#{type_cast} login = ?", login])
|
user = first(:conditions => ["#{type_cast} login = ?", login])
|
||||||
# Fail over to case-insensitive if none was found
|
# Fail over to case-insensitive if none was found
|
||||||
|
@ -3,7 +3,7 @@ class ChangeWikiContentsTextLimit < ActiveRecord::Migration
|
|||||||
# Migrates MySQL databases only
|
# Migrates MySQL databases only
|
||||||
# Postgres would raise an error (see http://dev.rubyonrails.org/ticket/3818)
|
# Postgres would raise an error (see http://dev.rubyonrails.org/ticket/3818)
|
||||||
# Not fixed in Rails 2.3.5
|
# Not fixed in Rails 2.3.5
|
||||||
if ActiveRecord::Base.connection.adapter_name =~ /mysql/i
|
if ChiliProject::Database.mysql?
|
||||||
max_size = 16.megabytes
|
max_size = 16.megabytes
|
||||||
change_column :wiki_contents, :text, :text, :limit => max_size
|
change_column :wiki_contents, :text, :text, :limit => max_size
|
||||||
change_column :wiki_content_versions, :data, :binary, :limit => max_size
|
change_column :wiki_content_versions, :data, :binary, :limit => max_size
|
||||||
|
Loading…
x
Reference in New Issue
Block a user