Sha256: 3e3099df240ca9560ee7b8607f9a7b3a5c9b45599f1f466bbe79a082268ffe33

Contents?: true

Size: 1.74 KB

Versions: 76

Compression:

Stored size: 1.74 KB

Contents

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

76 entries across 76 versions & 1 rubygems

Version Path
spree_core-4.0.9 db/migrate/20120831092359_spree_promo_one_two.rb
spree_core-4.1.15 db/migrate/20120831092359_spree_promo_one_two.rb
spree_core-4.2.7 db/migrate/20120831092359_spree_promo_one_two.rb
spree_core-4.3.3 db/migrate/20120831092359_spree_promo_one_two.rb
spree_core-4.2.6 db/migrate/20120831092359_spree_promo_one_two.rb
spree_core-4.3.2 db/migrate/20120831092359_spree_promo_one_two.rb
spree_core-4.3.1 db/migrate/20120831092359_spree_promo_one_two.rb
spree_core-4.3.0 db/migrate/20120831092359_spree_promo_one_two.rb
spree_core-4.3.0.rc3 db/migrate/20120831092359_spree_promo_one_two.rb
spree_core-4.3.0.rc2 db/migrate/20120831092359_spree_promo_one_two.rb
spree_core-4.3.0.rc1 db/migrate/20120831092359_spree_promo_one_two.rb
spree_core-4.2.5 db/migrate/20120831092359_spree_promo_one_two.rb
spree_core-4.1.14 db/migrate/20120831092359_spree_promo_one_two.rb
spree_core-4.0.8 db/migrate/20120831092359_spree_promo_one_two.rb
spree_core-4.2.4 db/migrate/20120831092359_spree_promo_one_two.rb
spree_core-3.7.14.1 db/migrate/20120831092359_spree_promo_one_two.rb
spree_core-4.2.3.1 db/migrate/20120831092359_spree_promo_one_two.rb
spree_core-4.1.13.1 db/migrate/20120831092359_spree_promo_one_two.rb
spree_core-4.0.7.1 db/migrate/20120831092359_spree_promo_one_two.rb
spree_core-4.2.3 db/migrate/20120831092359_spree_promo_one_two.rb