SQL server compatibility

This commit is contained in:
Karel Pičman 2025-04-23 10:41:29 +02:00
parent 4ea14d567a
commit 4499dda2cc
2 changed files with 10 additions and 2 deletions

View File

@ -72,7 +72,11 @@ class Dmsf144 < ActiveRecord::Migration[4.2]
t.change :lock_scope_cd, :integer, null: false t.change :lock_scope_cd, :integer, null: false
# Data cleanup # Data cleanup
t.rename :dmsf_file_id, :entity_id t.rename :dmsf_file_id, :entity_id
t.remove :locked # TODO: The column cannot be removed on SQL server due to NOT NULL constraint.
# The constraint's name is random and therefore cannot be easily removed.
if ActiveRecord::Base.connection.adapter_name.downcase != 'sqlserver'
t.remove :locked
end
end end
rename_table :dmsf_file_locks, :dmsf_locks rename_table :dmsf_file_locks, :dmsf_locks
# Not sure if this is the right place to do this, as its file manipulation, not database (strictly) # Not sure if this is the right place to do this, as its file manipulation, not database (strictly)

View File

@ -66,7 +66,11 @@ class DmsfFileContainerRollback < ActiveRecord::Migration[4.2]
# Make DB changes in dmsf_files # Make DB changes in dmsf_files
change_table :dmsf_files, bulk: true do |t| change_table :dmsf_files, bulk: true do |t|
t.remove_index %i[container_id container_type] t.remove_index %i[container_id container_type]
t.remove :container_type # TODO: The column cannot be removed on SQL server due to NOT NULL constraint.
# The constraint's name is random and therefore cannot be easily removed.
if ActiveRecord::Base.connection.adapter_name.downcase != 'sqlserver'
t.remove :container_type
end
t.rename :container_id, :project_id t.rename :container_id, :project_id
t.index :project_id t.index :project_id
end end