Project

General

Profile

Defect #30285 » sqlserver.patch

Pavel Rosický, 2019-06-11 21:34

View differences:

db/migrate/087_change_projects_description_to_text.rb (working copy)
class ChangeProjectsDescriptionToText < ActiveRecord::Migration[4.2]
def self.up
if Redmine::Database.sqlserver?
change_column :projects, :description, :text
end
change_column :projects, :description, :text, :null => true, :default => nil
end
db/migrate/20100705164950_change_changes_path_length_limit.rb (working copy)
class ChangeChangesPathLengthLimit < ActiveRecord::Migration[4.2]
def self.up
if Redmine::Database.sqlserver?
change_column :changes, :path, :text
end
# these are two steps to please MySQL 5 on Win32
change_column :changes, :path, :text, :default => nil, :null => true
change_column :changes, :path, :text, :null => false
db/migrate/20151020182334_change_attachments_filesize_limit_to_8.rb (working copy)
class ChangeAttachmentsFilesizeLimitTo8 < ActiveRecord::Migration[4.2]
def self.up
change_column :attachments, :filesize, :integer, :limit => 8, :default => 0, :null => false
if Redmine::Database.sqlserver?
change_column :attachments, :filesize, :bigint
change_column :attachments, :filesize, :bigint, :limit => 8, :default => 0, :null => false
else
change_column :attachments, :filesize, :integer, :limit => 8, :default => 0, :null => false
end
end
def self.down
Gemfile (working copy)
when /sqlite3/
gem "sqlite3", "~> 1.4.0", :platforms => [:mri, :mingw, :x64_mingw]
when /sqlserver/
gem "tiny_tds", "~> 1.0.5", :platforms => [:mri, :mingw, :x64_mingw]
gem "activerecord-sqlserver-adapter", :platforms => [:mri, :mingw, :x64_mingw]
gem "tiny_tds", "~> 2.1.2", :platforms => [:mri, :mingw, :x64_mingw]
gem "activerecord-sqlserver-adapter", "~> 5.2.0", :platforms => [:mri, :mingw, :x64_mingw]
else
warn("Unknown database adapter `#{adapter}` found in config/database.yml, use Gemfile.local to load your own database gems")
end
lib/redmine/database.rb (working copy)
/mysql/i.match?(ActiveRecord::Base.connection.adapter_name)
end
# Returns true if the database is SQL Server
def sqlserver?
/sqlserver/i.match?(ActiveRecord::Base.connection.adapter_name)
end
# Returns a SQL statement for case/accent (if possible) insensitive match
def like(left, right, options={})
neg = (options[:match] == false ? 'NOT ' : '')
lib/redmine/nested_set/issue_nested_set.rb (working copy)
end
def lock_nested_set
if /sqlserver/i.match?(self.class.connection.adapter_name)
if Redmine::Database.sqlserver?
lock = "WITH (ROWLOCK HOLDLOCK UPDLOCK)"
# Custom lock for SQLServer
# This can be problematic if root_id or parent root_id changes
lib/redmine/nested_set/project_nested_set.rb (working copy)
def lock_nested_set
lock = true
if /sqlserver/i.match?(self.class.connection.adapter_name)
if Redmine::Database.sqlserver?
lock = "WITH (ROWLOCK HOLDLOCK UPDLOCK)"
end
self.class.order(:id).lock(lock).ids
(1-1/3)