Sha256: eb087b59b3d7ab8d85fbbe6f7affb3576c8c6a9522c1d10ba44b35619b1d2c38

Contents?: true

Size: 786 Bytes

Versions: 120

Compression:

Stored size: 786 Bytes

Contents

class AddNumberToStockTransfer < ActiveRecord::Migration[4.2]
  def up
    remove_index :spree_stock_transfers, :source_location_id
    remove_index :spree_stock_transfers, :destination_location_id

    rename_column :spree_stock_transfers, :reference_number, :reference
    add_column :spree_stock_transfers, :number, :string

    Spree::StockTransfer.find_each do |transfer|
      transfer.send(:generate_stock_transfer_number)
      transfer.save!
    end

    add_index :spree_stock_transfers, :number
    add_index :spree_stock_transfers, :source_location_id
    add_index :spree_stock_transfers, :destination_location_id
  end

  def down
    rename_column :spree_stock_transfers, :reference, :reference_number
    remove_column :spree_stock_transfers, :number, :string
  end
end

Version data entries

120 entries across 120 versions & 1 rubygems

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