Skip to content

Commit

Permalink
Adding unique index for ContainerQuotaScope
Browse files Browse the repository at this point in the history
Adding unique index for ContainerQuotaScope
  • Loading branch information
Ladas committed Nov 14, 2017
1 parent a3242b0 commit 0ba6661
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class ComputerSystem < ActiveRecord::Base; end
class ContainerEnvVar < ActiveRecord::Base; end
class ContainerLimitItem < ActiveRecord::Base; end
class ContainerPortConfig < ActiveRecord::Base; end
class ContainerQuotaScope < ActiveRecord::Base; end
class ContainerQuotaItem < ActiveRecord::Base; end
class ContainerServicePortConfig < ActiveRecord::Base; end
class ContainerTemplateParameter < ActiveRecord::Base; end
Expand Down Expand Up @@ -58,6 +59,7 @@ def cleanup_duplicate_data_delete_all(model, unique_index_columns)
ContainerRoute => [:ems_id, :ems_ref],
ContainerService => [:ems_id, :ems_ref],
ContainerTemplate => [:ems_id, :ems_ref],
Container => [:ems_id, :ems_ref],
PersistentVolumeClaim => [:ems_id, :ems_ref],
# Having :ems_id but not ems_ref
ContainerImage => [:ems_id, :image_ref],
Expand All @@ -69,15 +71,14 @@ def cleanup_duplicate_data_delete_all(model, unique_index_columns)
ContainerEnvVar => [:container_id, :name, :value, :field_path],
ContainerLimitItem => [:container_limit_id, :resource, :item_type],
ContainerPortConfig => [:container_id, :ems_ref],
ContainerQuotaScope => [:container_quota_id, :scope],
ContainerQuotaItem => [:container_quota_id, :resource],
ContainerServicePortConfig => [:container_service_id, :name],
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
Container => [:ems_id, :ems_ref]
}.freeze

def up
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ def change
add_index :container_quota_items,
[:container_quota_id, :resource],
:unique => true
add_index :container_quota_scopes,
[:container_quota_id, :scope],
:unique => true
add_index :container_service_port_configs,
[:container_service_id, :name],
:unique => true,
Expand Down

0 comments on commit 0ba6661

Please sign in to comment.