NoMethodError: undefined method 'change_column'

This commit is contained in:
Karel Pičman 2023-05-15 12:19:11 +02:00
parent b07ec0662d
commit db1dc803d3
8 changed files with 30 additions and 30 deletions

View File

@ -67,12 +67,12 @@ class Dmsf144 < ActiveRecord::Migration[4.2]
DmsfFileLock.update_all entity_type: 0, lock_type_cd: 0, lock_scope_cd: 0
change_table :dmsf_file_locks, bulk: true do |t|
# These are not null-allowed columns
t.change_column :entity_type, :integer, null: false
t.change_column :lock_type_cd, :integer, null: false
t.change_column :lock_scope_cd, :integer, null: false
t.change :entity_type, :integer, null: false
t.change :lock_type_cd, :integer, null: false
t.change :lock_scope_cd, :integer, null: false
# Data cleanup
t.rename_column :dmsf_file_id, :entity_id
t.remove_column :locked
t.rename :dmsf_file_id, :entity_id
t.remove :locked
t.rename_table :dmsf_locks
end
# Not sure if this is the right place to do this, as its file manipulation, not database (strictly)
@ -120,11 +120,11 @@ class Dmsf144 < ActiveRecord::Migration[4.2]
DmsfFileLock.update_all locked: true
change_table :dmsf_file_locks, bulk: true do |t|
t.rename_column :entity_id, :dmsf_file_id
t.remove_column :entity_type
t.remove_column :lock_type_cd
t.remove_column :lock_scope_cd
t.remove_column :expires_at
t.remove_column :uuid
t.remove :entity_type
t.remove :lock_type_cd
t.remove :lock_scope_cd
t.remove :expires_at
t.remove :uuid
end
# Not sure if this is the right place to do this, as its file manipulation, not database (stricly)
begin

View File

@ -39,11 +39,11 @@ class CreateDmsfWorkflows < ActiveRecord::Migration[4.2]
def down
change_table :dmsf_file_revisions, bulk: true do |t|
t.remove_column :dmsf_workflow_id
t.remove_column :dmsf_workflow_assigned_by
t.remove_column :dmsf_workflow_assigned_at
t.remove_column :dmsf_workflow_started_by
t.remove_column :dmsf_workflow_started_at
t.remove :dmsf_workflow_id
t.remove :dmsf_workflow_assigned_by
t.remove :dmsf_workflow_assigned_at
t.remove :dmsf_workflow_started_by
t.remove :dmsf_workflow_started_at
end
drop_table :dmsf_workflows
end

View File

@ -32,8 +32,8 @@ class TrashBin < ActiveRecord::Migration[4.2]
def down
change_table :dmsf_folders, bulk: true do |t|
t.remove_column :deleted
t.remove_column :deleted_by_user_id
t.remove :deleted
t.remove :deleted_by_user_id
end
end
end

View File

@ -22,7 +22,7 @@
class AddExternal < ActiveRecord::Migration[4.2]
def up
change_table :dmsf_links, bulk: true do |t|
t.change_column :target_id, :integer, null: true
t.change :target_id, :integer, null: true
t.column :external_url, :string, null: true
end
end

View File

@ -36,9 +36,9 @@ class ApprovalWorkflowStdFields < ActiveRecord::Migration[4.2]
def down
change_table :dmsf_workflows, bulk: true do |t|
t.remove_column :updated_on
t.remove_column :created_on
t.remove_column :author_id
t.remove :updated_on
t.remove :created_on
t.remove :author_id
end
end
end

View File

@ -25,7 +25,7 @@ class DmsfFileContainer < ActiveRecord::Migration[4.2]
t.remove_index :project_id
t.rename_column :project_id, :container_id
t.column :container_type, :string, limit: 30, null: false, default: 'Project'
t.add_index %i[container_id container_type]
t.index %i[container_id container_type]
end
DmsfFile.update_all container_type: 'Project'
end
@ -33,9 +33,9 @@ class DmsfFileContainer < ActiveRecord::Migration[4.2]
def down
change_table :dmsf_files, bulk: true do |t|
t.remove_index %i[container_id container_type]
t.remove_column :container_type
t.remove :container_type
t.rename_column :container_id, :project_id
t.add_index :project_id
t.index :project_id
end
end
end

View File

@ -66,9 +66,9 @@ class DmsfFileContainerRollback < ActiveRecord::Migration[4.2]
# Make DB changes in dmsf_files
change_table :dmsf_files, bulk: true do |t|
t.remove_index %i[container_id container_type]
t.remove_column :container_type
t.remove :container_type
t.rename_column :container_id, :project_id
t.add_index :project_id
t.index :project_id
end
# Initialize system folder_flag to dmsf_folders
DmsfFolder.where(id: new_folder_ids).update_all system: true
@ -96,8 +96,8 @@ class DmsfFileContainerRollback < ActiveRecord::Migration[4.2]
file.save!
end
change_table :dmsf_files, bulk: true do |t|
t.remove_column :project_id # temporarily added for the save method
t.add_index(%i[container_id container_type]) unless t.index_exists?(%i[container_id container_type])
t.remove :project_id # temporarily added for the save method
t.index(%i[container_id container_type]) unless t.index_exists?(%i[container_id container_type])
end
# dmsf_folders
DmsfFolder.where(system: true).delete_all

View File

@ -23,14 +23,14 @@ class ChangeIndexInDmsfLocks < ActiveRecord::Migration[5.2]
def up
change_table :dmsf_locks, bulk: true do |t|
t.remove_index :entity_id
t.add_index %i[entity_id entity_type]
t.index %i[entity_id entity_type]
end
end
def down
change_table :dmsf_locks, bulk: true do |t|
t.remove_index %i[entity_id entity_type]
t.add_index :entity_id
t.index :entity_id
end
end
end