Sha256: 2dbc569ba09c194c2ae41dfac5d4acc0c0e110a848558ebf2729f839f4cfbfba

Contents?: true

Size: 1.81 KB

Versions: 9

Compression:

Stored size: 1.81 KB

Contents

# frozen_string_literal: true

class AddDbCommentsToFriendlyPromotionRules < ActiveRecord::Migration[6.1]
  def up
    if connection.supports_comments?
      change_table_comment(:friendly_promotion_rules, friendly_promotion_rules_table_comment)
      change_column_comment(:friendly_promotion_rules, :id, id_comment)
      change_column_comment(:friendly_promotion_rules, :promotion_id, promotion_id_comment)
      change_column_comment(:friendly_promotion_rules, :type, type_comment)
      change_column_comment(:friendly_promotion_rules, :created_at, created_at_comment)
      change_column_comment(:friendly_promotion_rules, :updated_at, updated_at_comment)
      change_column_comment(:friendly_promotion_rules, :preferences, preferences_comment)
    end
  end

  private

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

  def id_comment
    <<~COMMENT
      Primary key of this table.
    COMMENT
  end

  def promotion_id_comment
    <<~COMMENT
      Foreign key to the promotions table.
    COMMENT
  end

  def type_comment
    <<~COMMENT
      STI column. This represents which Ruby class to load when an entry of this table is loaded in Rails.
    COMMENT
  end

  def created_at_comment
    <<~COMMENT
      Timestamp indicating when this record was created.
    COMMENT
  end

  def updated_at_comment
    <<~COMMENT
      Timestamp indicating when this record was last updated.
    COMMENT
  end

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

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
solidus_friendly_promotions-1.9.3 db/migrate/20231011131324_add_db_comments_to_friendly_promotion_rules.rb
solidus_friendly_promotions-1.9.2 db/migrate/20231011131324_add_db_comments_to_friendly_promotion_rules.rb
solidus_friendly_promotions-1.9.1 db/migrate/20231011131324_add_db_comments_to_friendly_promotion_rules.rb
solidus_friendly_promotions-1.9.0 db/migrate/20231011131324_add_db_comments_to_friendly_promotion_rules.rb
solidus_friendly_promotions-1.0.0 db/migrate/20231011131324_add_db_comments_to_friendly_promotion_rules.rb
solidus_friendly_promotions-1.0.0.rc.3 db/migrate/20231011131324_add_db_comments_to_friendly_promotion_rules.rb
solidus_friendly_promotions-1.0.0.rc.2 db/migrate/20231011131324_add_db_comments_to_friendly_promotion_rules.rb
solidus_friendly_promotions-1.0.0.rc.1 db/migrate/20231011131324_add_db_comments_to_friendly_promotion_rules.rb
solidus_friendly_promotions-1.0.0.pre db/migrate/20231011131324_add_db_comments_to_friendly_promotion_rules.rb