From 09d1d574d9137445827976c21c8a1ab47307390a Mon Sep 17 00:00:00 2001 From: Vincent Pochet Date: Mon, 1 Jul 2024 17:46:04 +0200 Subject: [PATCH] misc(event): Ensure updating charge filter is touching the related charge --- app/models/charge_filter.rb | 2 +- .../20240701083355_create_billable_metrics_grouped_charges.rb | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/models/charge_filter.rb b/app/models/charge_filter.rb index 16f082040af..ec76541828c 100644 --- a/app/models/charge_filter.rb +++ b/app/models/charge_filter.rb @@ -5,7 +5,7 @@ class ChargeFilter < ApplicationRecord include Discard::Model self.discard_column = :deleted_at - belongs_to :charge, -> { with_discarded } + belongs_to :charge, -> { with_discarded }, touch: true has_many :values, class_name: 'ChargeFilterValue', dependent: :destroy has_many :billable_metric_filters, through: :values diff --git a/db/migrate/20240701083355_create_billable_metrics_grouped_charges.rb b/db/migrate/20240701083355_create_billable_metrics_grouped_charges.rb index a7db3208fcb..5964918ae2e 100644 --- a/db/migrate/20240701083355_create_billable_metrics_grouped_charges.rb +++ b/db/migrate/20240701083355_create_billable_metrics_grouped_charges.rb @@ -1,6 +1,8 @@ # frozen_string_literal: true class CreateBillableMetricsGroupedCharges < ActiveRecord::Migration[7.1] + disable_ddl_transaction! + def change create_view :billable_metrics_grouped_charges end