Sha256: a04b711947d1568f3df8cef1f1d3141d73a5626d0b63796db913a8bfac6eadaf

Contents?: true

Size: 1.55 KB

Versions: 4

Compression:

Stored size: 1.55 KB

Contents

# frozen_string_literal: true

class AddDbCommentsToFriendlyPromotionRulesUsers < ActiveRecord::Migration[6.1]
  def up
    if connection.supports_comments?
      change_table_comment(:friendly_promotion_rules_users, friendly_promotion_rules_users_table_comment)
      change_column_comment(:friendly_promotion_rules_users, :user_id, user_id_comment)
      change_column_comment(:friendly_promotion_rules_users, :promotion_rule_id, promotion_rule_id_comment)
      change_column_comment(:friendly_promotion_rules_users, :id, id_comment)
      change_column_comment(:friendly_promotion_rules_users, :created_at, created_at_comment)
      change_column_comment(:friendly_promotion_rules_users, :updated_at, updated_at_comment)
    end
  end

  private

  def friendly_promotion_rules_users_table_comment
    <<~COMMENT
      Join table between promotion rules and users. Used with promotion rules of type "SolidusFriendlyPromotions::Conditions::User".
      An entry here indicates that a promotion is eligible for the user ID specified here.
    COMMENT
  end

  def user_id_comment
    <<~COMMENT
      Foreign key to the users table.
    COMMENT
  end

  def promotion_rule_id_comment
    <<~COMMENT
      Foreign key to the promotion_rules table.
    COMMENT
  end

  def id_comment
    <<~COMMENT
      Primary key of this table.
    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
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
solidus_friendly_promotions-1.9.3 db/migrate/20231011142040_add_db_comments_to_friendly_promotion_rules_users.rb
solidus_friendly_promotions-1.9.2 db/migrate/20231011142040_add_db_comments_to_friendly_promotion_rules_users.rb
solidus_friendly_promotions-1.9.1 db/migrate/20231011142040_add_db_comments_to_friendly_promotion_rules_users.rb
solidus_friendly_promotions-1.9.0 db/migrate/20231011142040_add_db_comments_to_friendly_promotion_rules_users.rb