diff --git a/db/migrate/20171018081206_showback_fix_and_rename.rb b/db/migrate/20171018081206_showback_fix_and_rename.rb new file mode 100644 index 000000000..3f91c7ed6 --- /dev/null +++ b/db/migrate/20171018081206_showback_fix_and_rename.rb @@ -0,0 +1,51 @@ +class ShowbackFixAndRename < ActiveRecord::Migration[5.0] + def self.up + rename_table :showback_events, :data_rollups + rename_table :showback_charges, :data_views + rename_table :showback_price_plans, :price_plans + rename_table :showback_pools, :envelopes + rename_table :showback_rates, :rates + rename_table :showback_tiers, :tiers + rename_table :showback_usage_types, :input_measures + + rename_column :data_views, :showback_event_id, :data_rollup_id + rename_column :data_views, :showback_pool_id, :envelope_id + rename_column :rates, :showback_price_plan_id, :price_plan_id + rename_column :tiers, :showback_rate_id, :rate_id + + rename_column :rates, :category, :entity + rename_column :rates, :dimension, :field + rename_column :rates, :measure, :group + rename_column :rates, :step_variable, :tier_input_variable + rename_column :rates, :date, :start_date + + rename_column :input_measures, :category, :entity + rename_column :input_measures, :dimensions, :fields + rename_column :input_measures, :measure, :group + end + + def self.down + rename_table :data_rollups, :showback_events + rename_table :data_views, :showback_charges + rename_table :price_plans, :showback_price_plans + rename_table :envelopes, :showback_pools + rename_table :rates, :showback_rates + rename_table :tiers, :showback_tiers + rename_table :input_measures, :showback_usage_types + + rename_column :showback_charges, :data_rollup_id, :showback_event_id + rename_column :showback_charges, :envelope_id, :showback_pool_id + rename_column :showback_rates, :price_plan_id, :showback_price_plan_id + rename_column :showback_tiers, :rate_id, :showback_rate_id + + rename_column :showback_rates, :entity, :category + rename_column :showback_rates, :field, :dimension + rename_column :showback_rates, :group, :measure + rename_column :showback_rates, :tier_input_variable, :step_variable + rename_column :showback_rates, :start_date, :date + + rename_column :showback_usage_types, :entity, :category + rename_column :showback_usage_types, :fields, :dimensions + rename_column :showback_usage_types, :group, :measure + end +end diff --git a/db/schema.yml b/db/schema.yml index 86175fd7d..8798717f6 100644 --- a/db/schema.yml +++ b/db/schema.yml @@ -1027,6 +1027,25 @@ customization_templates: - pxe_image_type_id - type - system +data_rollups: +- id +- data +- start_time +- end_time +- resource_type +- resource_id +- context +- created_at +- updated_at +data_views: +- id +- cost_subunits +- cost_currency +- envelope_id +- data_rollup_id +- created_at +- updated_at +- stored_data database_backups: - id - name @@ -1191,6 +1210,19 @@ entitlements: - updated_at - filters - filter_expression +envelopes: +- id +- name +- description +- start_time +- end_time +- state +- accumulated_cost_subunits +- accumulated_cost_currency +- resource_type +- resource_id +- created_at +- updated_at event_logs: - id - name @@ -1558,6 +1590,14 @@ hosts: - physical_server_id import_file_uploads: - id +input_measures: +- id +- entity +- description +- group +- fields +- created_at +- updated_at iso_datastores: - id - ems_id @@ -5655,6 +5695,14 @@ policy_events: - host_id - ems_cluster_id - ems_id +price_plans: +- id +- name +- resource_type +- resource_id +- description +- created_at +- updated_at providers: - id - type @@ -5704,6 +5752,21 @@ pxe_servers: - pxe_directory - customization_directory - windows_images_directory +rates: +- id +- calculation +- entity +- field +- screener +- start_date +- concept +- price_plan_id +- created_at +- updated_at +- group +- tier_input_variable +- uses_single_tier +- tiers_use_full_value registry_items: - id - miq_set_id @@ -5958,85 +6021,6 @@ shares: - allow_tenant_inheritance - created_at - updated_at -showback_charges: -- id -- cost_subunits -- cost_currency -- showback_pool_id -- showback_event_id -- created_at -- updated_at -- stored_data -showback_events: -- id -- data -- start_time -- end_time -- resource_type -- resource_id -- context -- created_at -- updated_at -showback_pools: -- id -- name -- description -- start_time -- end_time -- state -- accumulated_cost_subunits -- accumulated_cost_currency -- resource_type -- resource_id -- created_at -- updated_at -showback_price_plans: -- id -- name -- resource_type -- resource_id -- description -- created_at -- updated_at -showback_rates: -- id -- calculation -- category -- dimension -- screener -- date -- concept -- showback_price_plan_id -- created_at -- updated_at -- measure -- step_variable -- uses_single_tier -- tiers_use_full_value -showback_tiers: -- id -- tier_start_value -- tier_end_value -- fixed_rate_subunits -- fixed_rate_currency -- fixed_rate_per_time -- variable_rate_subunits -- variable_rate_currency -- variable_rate_per_unit -- variable_rate_per_time -- step_value -- step_time_unit -- step_time_value -- step_unit -- showback_rate_id -showback_usage_types: -- id -- category -- description -- measure -- dimensions -- created_at -- updated_at snapshots: - id - uid @@ -6196,6 +6180,22 @@ tenants: - default_miq_group_id - source_type - source_id +tiers: +- id +- tier_start_value +- tier_end_value +- fixed_rate_subunits +- fixed_rate_currency +- fixed_rate_per_time +- variable_rate_subunits +- variable_rate_currency +- variable_rate_per_unit +- variable_rate_per_time +- step_value +- step_time_unit +- step_time_value +- step_unit +- rate_id time_profiles: - id - description