1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-02-20 14:54:15 +01:00

adds a migrations to fix all statistic_sub_types of plans having label = nil

This commit is contained in:
Nicolas Florentin 2023-11-08 10:48:39 +01:00
parent 519dbefd2f
commit 7d1fae84fe
2 changed files with 15 additions and 1 deletions

View File

@ -2,7 +2,8 @@
## next deploy
- Fix a bug: statistic_subtype.label of plan was nil
- Fix a bug: statistic_sub_type.label of plan was nil
- adds a migrations to fix all statistic_sub_types of plans having label = nil
## v6.3.0 2023 November 3

View File

@ -0,0 +1,13 @@
class FixPlanStatisticSubTypes < ActiveRecord::Migration[7.0]
def up
StatisticSubType.joins(statistic_types: :statistic_index).where(statistic_indices: { es_type_key: "subscription" }, label: nil).each do |statistic_sub_type|
plan = Plan.find_by(slug: statistic_sub_type.key)
if plan
statistic_sub_type.update_column(:label, plan.name)
end
end
end
def down
end
end