Sha256: 0ff4ef5818f5b927f729d00abb6f3e82bb11e3de4f966c39b06b854e8d39e17e

Contents?: true

Size: 1.97 KB

Versions: 5

Compression:

Stored size: 1.97 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::Actions::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

5 entries across 5 versions & 1 rubygems

Version Path
solidus_friendly_promotions-1.0.0 db/migrate/20231011190222_add_db_comments_to_friendly_promotion_actions.rb
solidus_friendly_promotions-1.0.0.rc.3 db/migrate/20231011190222_add_db_comments_to_friendly_promotion_actions.rb
solidus_friendly_promotions-1.0.0.rc.2 db/migrate/20231011190222_add_db_comments_to_friendly_promotion_actions.rb
solidus_friendly_promotions-1.0.0.rc.1 db/migrate/20231011190222_add_db_comments_to_friendly_promotion_actions.rb
solidus_friendly_promotions-1.0.0.pre db/migrate/20231011190222_add_db_comments_to_friendly_promotion_actions.rb