Sha256: ef31ef1b98a08ce6ab7ec9175f2fb172aabe139fc859ad51ee5e5f7b55852025

Contents?: true

Size: 780 Bytes

Versions: 18

Compression:

Stored size: 780 Bytes

Contents

class AddNumberToStockTransfer < ActiveRecord::Migration
  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.all.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

18 entries across 18 versions & 1 rubygems

Version Path
spree_core-2.2.0 db/migrate/20130509115210_add_number_to_stock_transfer.rb
spree_core-2.1.5 db/migrate/20130509115210_add_number_to_stock_transfer.rb
spree_core-2.0.9 db/migrate/20130509115210_add_number_to_stock_transfer.rb
spree_core-2.1.4 db/migrate/20130509115210_add_number_to_stock_transfer.rb
spree_core-2.0.8 db/migrate/20130509115210_add_number_to_stock_transfer.rb
spree_core-2.1.3 db/migrate/20130509115210_add_number_to_stock_transfer.rb
spree_core-2.0.7 db/migrate/20130509115210_add_number_to_stock_transfer.rb
spree_core-2.1.2 db/migrate/20130509115210_add_number_to_stock_transfer.rb
spree_core-2.0.6 db/migrate/20130509115210_add_number_to_stock_transfer.rb
spree_core-2.1.1 db/migrate/20130509115210_add_number_to_stock_transfer.rb
spree_core-2.0.5 db/migrate/20130509115210_add_number_to_stock_transfer.rb
spree_core-2.1.0 db/migrate/20130509115210_add_number_to_stock_transfer.rb
spree_core-2.0.4 db/migrate/20130509115210_add_number_to_stock_transfer.rb
spree_core-2.0.3 db/migrate/20130509115210_add_number_to_stock_transfer.rb
spree_core-2.0.2 db/migrate/20130509115210_add_number_to_stock_transfer.rb
spree_core-2.0.1 db/migrate/20130509115210_add_number_to_stock_transfer.rb
spree_core-2.0.0 db/migrate/20130509115210_add_number_to_stock_transfer.rb
spree_core-2.0.0.rc1 db/migrate/20130509115210_add_number_to_stock_transfer.rb