Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename Tables and some changes for Showback Models #96

Merged
merged 1 commit into from
Oct 27, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions db/migrate/20171018081206_showback_fix_and_rename.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
class ShowbackFixAndRename < ActiveRecord::Migration[5.0]
def change
rename_table :showback_events, :showback_data_rollups
rename_table :showback_charges, :showback_data_views
rename_table :showback_pools, :showback_envelopes
rename_table :showback_usage_types, :showback_input_measures

rename_column :showback_data_views, :showback_event_id, :showback_data_rollup_id
rename_column :showback_data_views, :showback_pool_id, :showback_envelope_id

rename_column :showback_rates, :category, :entity
rename_column :showback_rates, :dimension, :field
rename_column :showback_rates, :measure, :group
rename_column :showback_rates, :step_variable, :tier_input_variable
rename_column :showback_rates, :date, :start_date

rename_column :showback_input_measures, :category, :entity
rename_column :showback_input_measures, :dimensions, :fields
rename_column :showback_input_measures, :measure, :group

rename_column :showback_data_views, :stored_data, :data_snapshot

add_column :showback_data_views, :context_snapshot, :jsonb
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure why these cols are being added. @aljesusg can you comment?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to store the context in the dataview, because formerly we were using it in the event, but our aim is to avoid having to have an event at all. Thus, we need to store the context in the data view too

add_column :showback_data_views, :start_time, :timestamp
add_column :showback_data_views, :end_time, :timestamp
end
end
51 changes: 27 additions & 24 deletions db/schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5958,16 +5958,7 @@ 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:
showback_data_rollups:
- id
- data
- start_time
Expand All @@ -5977,7 +5968,19 @@ showback_events:
- context
- created_at
- updated_at
showback_pools:
showback_data_views:
- id
- cost_subunits
- cost_currency
- showback_envelope_id
- showback_data_rollup_id
- created_at
- updated_at
- data_snapshot
- context_snapshot
- start_time
- end_time
showback_envelopes:
- id
- name
- description
Expand All @@ -5990,6 +5993,14 @@ showback_pools:
- resource_id
- created_at
- updated_at
showback_input_measures:
- id
- entity
- description
- group
- fields
- created_at
- updated_at
showback_price_plans:
- id
- name
Expand All @@ -6001,16 +6012,16 @@ showback_price_plans:
showback_rates:
- id
- calculation
- category
- dimension
- entity
- field
- screener
- date
- start_date
- concept
- showback_price_plan_id
- created_at
- updated_at
- measure
- step_variable
- group
- tier_input_variable
- uses_single_tier
- tiers_use_full_value
showback_tiers:
Expand All @@ -6029,14 +6040,6 @@ showback_tiers:
- step_time_value
- step_unit
- showback_rate_id
showback_usage_types:
- id
- category
- description
- measure
- dimensions
- created_at
- updated_at
snapshots:
- id
- uid
Expand Down