Sha256: d849e2deb1a40b4d11682474d04c40884401da399d7b62154a885cbb23677174

Contents?: true

Size: 752 Bytes

Versions: 1

Compression:

Stored size: 752 Bytes

Contents

class AddSpreeCreateSalePricesTable < SolidusSupport::Migration[4.2]
  def change
    create_table :spree_sale_prices do |t|
      t.integer :price_id
      t.float :value
      t.datetime :start_at
      t.datetime :end_at
      t.boolean :enabled
      t.timestamps
    end

    # Getting active sale prices for a price
    add_index :spree_sale_prices, [:price_id, :start_at, :end_at, :enabled], :name => "index_active_sale_prices_for_price"
    # Getting all active sale prices for all prices
    add_index :spree_sale_prices, [:start_at, :end_at, :enabled], :name => "index_active_sale_prices_for_all_variants"
    # Getting all sale prices for a price
    add_index :spree_sale_prices, :price_id, :name => "index_sale_prices_for_price"
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
solidus_sale_pricing-2.0.1 db/migrate/20160622203615_add_spree_create_sale_prices_table.rb