Skip to content

Commit

Permalink
Add Comp.System, Hardware and Op. System indexes
Browse files Browse the repository at this point in the history
Add Comp.System, Hardware and Op. System indexes
  • Loading branch information
Ladas committed Jul 14, 2017
1 parent 820030f commit d5fed05
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ def cleanup_duplicate_data_delete_all(model, unique_index_columns)
# Nested tables, not having :ems_id and the foreign_key is a part of the unique index
ContainerCondition => [:container_entity_id, :container_entity_type, :name],
SecurityContext => [:resource_id, :resource_type],
ComputerSystem => [:managed_entity_id, :managed_entity_type],
ContainerEnvVar => [:container_definition_id, :name, :value, :field_path],
ContainerLimitItem => [:container_limit_id, :resource, :item_type],
ContainerPortConfig => [:container_definition_id, :ems_ref],
Expand All @@ -73,6 +74,8 @@ def cleanup_duplicate_data_delete_all(model, unique_index_columns)
ContainerTemplateParameter => [:container_template_id, :name],
ContainerVolume => [:parent_id, :parent_type, :name],
CustomAttribute => [:resource_id, :resource_type, :name, :unique_name, :section, :source],
Hardware => [:vm_or_template_id, :host_id, :computer_system_id],
OperatingSystem => [:vm_or_template_id, :host_id, :computer_system_id],
# Questionable
ContainerDefinition => [:ems_id, :ems_ref],
Container => [:ems_id, :ems_ref]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ def change
[:resource_id, :resource_type],
:unique => true,
:name => "index_security_contexts_unique_multi_column"
add_index :computer_systems,
[:managed_entity_id, :managed_entity_type],
:unique => true,
:name => "index_computer_systems_unique_multi_column"
add_index :container_env_vars,
[:container_definition_id, :name, :value, :field_path],
:unique => true,
Expand Down Expand Up @@ -65,6 +69,14 @@ def change
[:resource_id, :resource_type, :name, :unique_name, :section, :source],
:unique => true,
:name => "index_custom_attributes_parameters_unique_multi_column"
add_index :hardwares,
[:vm_or_template_id, :host_id, :computer_system_id],
:unique => true,
:name => "index_hardwares_on_unique_multi_column"
add_index :operating_systems,
[:vm_or_template_id, :host_id, :computer_system_id],
:unique => true,
:name => "index_operating_systems_unique_multi_column"

# FIXME(lsmola) questionable, these were modeled as nested, but they have :ems_id & :ems_ref
# Is ems_ref unique? we were saving these under container_group
Expand Down

0 comments on commit d5fed05

Please sign in to comment.