Sha256: 442a6a6d98ab25ddd69540caca2b48126115a3b24011dea37615a1a20fed578d

Contents?: true

Size: 1.98 KB

Versions: 4

Compression:

Stored size: 1.98 KB

Contents

# frozen_string_literal: true

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

  private

  def friendly_promotion_actions_table_comment
    <<~COMMENT
      Single Table inheritance table. Represents what to do to an order when the linked promotion is eligible.
      Promotions can have many promotion actions.
    COMMENT
  end

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

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

  def type_comment
    <<~COMMENT
      A class name representing which promotion action this represents.
      Usually SolidusFriendlyPromotions::PromotionAction::Adjust{LineItem,Shipment}.
    COMMENT
  end

  def deleted_at_comment
    <<~COMMENT
      Timestamp indicating if and when this record was soft-deleted.
    COMMENT
  end

  def preferences_comment
    <<~COMMENT
      Preferences for this promotion action. Serialized YAML.
    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/20231011190222_add_db_comments_to_friendly_promotion_actions.rb
solidus_friendly_promotions-1.9.2 db/migrate/20231011190222_add_db_comments_to_friendly_promotion_actions.rb
solidus_friendly_promotions-1.9.1 db/migrate/20231011190222_add_db_comments_to_friendly_promotion_actions.rb
solidus_friendly_promotions-1.9.0 db/migrate/20231011190222_add_db_comments_to_friendly_promotion_actions.rb