Index: db/migrate/087_change_projects_description_to_text.rb =================================================================== --- db/migrate/087_change_projects_description_to_text.rb (revision 18254) +++ db/migrate/087_change_projects_description_to_text.rb (working copy) @@ -1,5 +1,8 @@ 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 Index: db/migrate/20100705164950_change_changes_path_length_limit.rb =================================================================== --- db/migrate/20100705164950_change_changes_path_length_limit.rb (revision 18254) +++ db/migrate/20100705164950_change_changes_path_length_limit.rb (working copy) @@ -1,5 +1,8 @@ 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 Index: db/migrate/20151020182334_change_attachments_filesize_limit_to_8.rb =================================================================== --- db/migrate/20151020182334_change_attachments_filesize_limit_to_8.rb (revision 18254) +++ db/migrate/20151020182334_change_attachments_filesize_limit_to_8.rb (working copy) @@ -1,6 +1,11 @@ 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 Index: Gemfile =================================================================== --- Gemfile (revision 18254) +++ Gemfile (working copy) @@ -59,8 +59,8 @@ 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 Index: lib/redmine/database.rb =================================================================== --- lib/redmine/database.rb (revision 18254) +++ lib/redmine/database.rb (working copy) @@ -51,6 +51,11 @@ /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 ' : '') Index: lib/redmine/nested_set/issue_nested_set.rb =================================================================== --- lib/redmine/nested_set/issue_nested_set.rb (revision 18254) +++ lib/redmine/nested_set/issue_nested_set.rb (working copy) @@ -151,7 +151,7 @@ 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 Index: lib/redmine/nested_set/project_nested_set.rb =================================================================== --- lib/redmine/nested_set/project_nested_set.rb (revision 18254) +++ lib/redmine/nested_set/project_nested_set.rb (working copy) @@ -121,7 +121,7 @@ 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