Commit d9010242 authored by Holger Just's avatar Holger Just

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

parent 82791440
......@@ -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
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment