Sha256: daa6730a9b074d76bf2683e6ca6abf21e47b66390855d1aa682072a633f3b015

Contents?: true

Size: 1.01 KB

Versions: 1

Compression:

Stored size: 1.01 KB

Contents

class UpdateColumnCommentsForConditions < ActiveRecord::Migration[7.1]
  def up
    if connection.supports_comments?
      change_table_comment(:friendly_conditions, friendly_conditions_table_comment)
      change_column_comment(:friendly_conditions, :benefit_id, benefit_id_comment)
      change_column_comment(:friendly_conditions, :preferences, preferences_comment)
    end
  end

  private

  def friendly_conditions_table_comment
    <<~COMMENT
      Represents a promotion benefit condition. A promotion benefit may have many conditions, which determine whether the benefit is eligible.
      All conditions must be eligible for the benefit to be eligible. If there are no conditions, the benefit is always eligible.
    COMMENT
  end

  def benefit_id_comment
    <<~COMMENT
      Foreign key to the friendly_benefits table.
    COMMENT
  end

  def preferences_comment
    <<~COMMENT
      Preferences for this promotion condition. Serialized YAML column with preferences for this promotion condition.
    COMMENT
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
solidus_friendly_promotions-1.9.0 db/migrate/20240612114132_update_column_comments_for_conditions.rb