Karel Pičman 2018-11-07 17:56:04 +01:00
parent 19a8232c17
commit 13d2de6661
12 changed files with 14 additions and 14 deletions

View File

@ -26,7 +26,7 @@ class CreateDmsfWorkflows < ActiveRecord::Migration
t.string :name, null: false t.string :name, null: false
t.references :project t.references :project
end end
add_index :dmsf_workflows, [:name], unique: true, name: :index_dmsf_workflows_on_name add_index :dmsf_workflows, [:name], unique: true
change_table :dmsf_file_revisions do |t| change_table :dmsf_file_revisions do |t|
t.references :dmsf_workflow t.references :dmsf_workflow

View File

@ -27,7 +27,7 @@ class CreateDmsfWorkflowSteps < ActiveRecord::Migration
t.references :user, null: false t.references :user, null: false
t.integer :operator, null: false t.integer :operator, null: false
end end
add_index :dmsf_workflow_steps, :dmsf_workflow_id, name: :index_dmsf_workflow_steps_on_dmsf_workflow_id add_index :dmsf_workflow_steps, :dmsf_workflow_id
end end
end end

View File

@ -21,7 +21,7 @@
class AddIndexToDmsfFiles < ActiveRecord::Migration class AddIndexToDmsfFiles < ActiveRecord::Migration
def change def change
add_index :dmsf_files, :project_id, name: :index_dmsf_files_on_project_id add_index :dmsf_files, :project_id
end end
end end

View File

@ -21,7 +21,7 @@
class AddIndexToDmsfFolders < ActiveRecord::Migration class AddIndexToDmsfFolders < ActiveRecord::Migration
def change def change
add_index :dmsf_folders, :project_id, name: :index_dmsf_folders_on_project_id add_index :dmsf_folders, :project_id
end end
end end

View File

@ -21,7 +21,7 @@
class AddIndexToDmsfFileRevision < ActiveRecord::Migration class AddIndexToDmsfFileRevision < ActiveRecord::Migration
def change def change
add_index :dmsf_file_revisions, :dmsf_file_id, name: :index_dmsf_file_revisions_on_dmsf_file_id add_index :dmsf_file_revisions, :dmsf_file_id
end end
end end

View File

@ -21,7 +21,7 @@
class AddIndexToDmsfLock < ActiveRecord::Migration class AddIndexToDmsfLock < ActiveRecord::Migration
def change def change
add_index :dmsf_locks, :entity_id, name: :index_dmsf_locks_on_entity_id add_index :dmsf_locks, :entity_id
end end
end end

View File

@ -32,7 +32,7 @@ class CreateDmsfLinks < ActiveRecord::Migration
t.integer :deleted_by_user_id t.integer :deleted_by_user_id
t.timestamps null: false t.timestamps null: false
end end
add_index :dmsf_links, :project_id, name: :index_dmsf_links_on_project_id add_index :dmsf_links, :project_id
end end
end end

View File

@ -28,7 +28,7 @@ class CreateDmsfPublicUrls < ActiveRecord::Migration
t.datetime :expire_at, null: false t.datetime :expire_at, null: false
t.timestamps t.timestamps
end end
add_index :dmsf_public_urls, :token, name: :index_dmsf_public_urls_on_token add_index :dmsf_public_urls, :token
end end
end end

View File

@ -26,14 +26,14 @@ class DmsfFileContainer < ActiveRecord::Migration
add_column :dmsf_files, :container_type, :string, limit: 30, null: false, add_column :dmsf_files, :container_type, :string, limit: 30, null: false,
default: 'Project' default: 'Project'
DmsfFile.update_all container_type: 'Project' DmsfFile.update_all container_type: 'Project'
add_index :dmsf_files, [:container_id, :container_type], name: :index_dmsf_files_on_container_id_container_type add_index :dmsf_files, [:container_id, :container_type]
end end
def down def down
remove_index :dmsf_files, [:container_id, :container_type] remove_index :dmsf_files, [:container_id, :container_type]
remove_column :dmsf_files, :container_type remove_column :dmsf_files, :container_type
rename_column :dmsf_files, :container_id, :project_id rename_column :dmsf_files, :container_id, :project_id
add_index :dmsf_files, :project_id, name: :index_dmsf_files_on_project_id add_index :dmsf_files, :project_id
end end
end end

View File

@ -26,7 +26,7 @@ class CreateDmsfFolderPermissions < ActiveRecord::Migration
t.integer :object_id, null: false t.integer :object_id, null: false
t.string :object_type, limit: 30, null: false t.string :object_type, limit: 30, null: false
end end
add_index :dmsf_folder_permissions, :dmsf_folder_id, name: :index_dmsf_folder_permissions_on_dmsf_folder_id add_index :dmsf_folder_permissions, :dmsf_folder_id
end end
end end

View File

@ -63,7 +63,7 @@ class DmsfFileContainerRollback < ActiveRecord::Migration
remove_index :dmsf_files, [:container_id, :container_type] remove_index :dmsf_files, [:container_id, :container_type]
remove_column :dmsf_files, :container_type remove_column :dmsf_files, :container_type
rename_column :dmsf_files, :container_id, :project_id rename_column :dmsf_files, :container_id, :project_id
add_index :dmsf_files, :project_id, name: :index_dmsf_files_on_project_id add_index :dmsf_files, :project_id
# Initialize system folder_flag to dmsf_folders # Initialize system folder_flag to dmsf_folders
DmsfFolder.where(id: new_folder_ids).update_all(system: true) DmsfFolder.where(id: new_folder_ids).update_all(system: true)
end end
@ -88,7 +88,7 @@ class DmsfFileContainerRollback < ActiveRecord::Migration
end end
end end
remove_column :dmsf_files, :project_id # temporarily added for the save method remove_column :dmsf_files, :project_id # temporarily added for the save method
add_index :dmsf_files, [:container_id, :container_type], name: :index_dmsf_files_on_container_id_container_type add_index :dmsf_files, [:container_id, :container_type]
# dmsf_folders # dmsf_folders
DmsfFolder.where(system: true).delete_all DmsfFolder.where(system: true).delete_all
remove_column :dmsf_folders, :system remove_column :dmsf_folders, :system

View File

@ -21,7 +21,7 @@
class AddIndexToDmsfFolder < ActiveRecord::Migration class AddIndexToDmsfFolder < ActiveRecord::Migration
def change def change
add_index :dmsf_folders, :dmsf_folder_id, name: :index_dmsf_folders_on_dmsf_folder_id add_index :dmsf_folders, :dmsf_folder_id
end end
end end