Sha256: f4804140c2fe85c0027c859ef208db6850d441be3bf688f67745359922f19dff

Contents?: true

Size: 1.8 KB

Versions: 3

Compression:

Stored size: 1.8 KB

Contents

# This migration comes from spree (originally 20120831092359)
class SpreePromoOneTwo < ActiveRecord::Migration[4.2]
  def up
    # This migration is just a compressed migration for all previous versions of spree_promo
    return if data_source_exists?(:spree_products_promotion_rules)

    create_table :spree_products_promotion_rules, id: false, force: true do |t|
      t.references :product
      t.references :promotion_rule
    end

    add_index :spree_products_promotion_rules, [:product_id], name: 'index_products_promotion_rules_on_product_id'
    add_index :spree_products_promotion_rules, [:promotion_rule_id], name: 'index_products_promotion_rules_on_promotion_rule_id'

    create_table :spree_promotion_action_line_items, force: true do |t|
      t.references :promotion_action
      t.references :variant
      t.integer    :quantity,            default: 1
    end

    create_table :spree_promotion_actions, force: true do |t|
      t.references :activator
      t.integer    :position
      t.string     :type
    end

    create_table :spree_promotion_rules, force: true do |t|
      t.references :activator
      t.references :user
      t.references :product_group
      t.string     :type
      t.timestamps null: false, precision: 6
    end

    add_index :spree_promotion_rules, [:product_group_id], name: 'index_promotion_rules_on_product_group_id'
    add_index :spree_promotion_rules, [:user_id], name: 'index_promotion_rules_on_user_id'

    create_table :spree_promotion_rules_users, id: false, force: true do |t|
      t.references :user
      t.references :promotion_rule
    end

    add_index :spree_promotion_rules_users, [:promotion_rule_id], name: 'index_promotion_rules_users_on_promotion_rule_id'
    add_index :spree_promotion_rules_users, [:user_id], name: 'index_promotion_rules_users_on_user_id'
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
spree_purchase_order-3.7.0 spec/dummy/db/migrate/20191113195711_spree_promo_one_two.spree.rb
spree_billing_sisow-0.9.2 spec/dummy/db/migrate/20190729091652_spree_promo_one_two.spree.rb
spree_billing_sisow-0.9.1 spec/dummy/db/migrate/20190729091652_spree_promo_one_two.spree.rb