Sha256: 08cea398bae28101eeef2cda26e7581abc5e9378c734e26c967c18702bf0267b

Contents?: true

Size: 799 Bytes

Versions: 21

Compression:

Stored size: 799 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.with_deleted.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

21 entries across 21 versions & 1 rubygems

Version Path
solidus_core-2.3.1 db/migrate/20130509115210_add_number_to_stock_transfer.rb
solidus_core-2.2.2 db/migrate/20130509115210_add_number_to_stock_transfer.rb
solidus_core-2.1.1 db/migrate/20130509115210_add_number_to_stock_transfer.rb
solidus_core-2.0.3 db/migrate/20130509115210_add_number_to_stock_transfer.rb
solidus_core-2.3.0 db/migrate/20130509115210_add_number_to_stock_transfer.rb
solidus_core-2.3.0.rc3 db/migrate/20130509115210_add_number_to_stock_transfer.rb
solidus_core-2.3.0.rc2 db/migrate/20130509115210_add_number_to_stock_transfer.rb
solidus_core-2.3.0.rc1 db/migrate/20130509115210_add_number_to_stock_transfer.rb
solidus_core-2.3.0.beta1 db/migrate/20130509115210_add_number_to_stock_transfer.rb
solidus_core-2.0.2 db/migrate/20130509115210_add_number_to_stock_transfer.rb
solidus_core-2.2.1 db/migrate/20130509115210_add_number_to_stock_transfer.rb
solidus_core-2.2.0 db/migrate/20130509115210_add_number_to_stock_transfer.rb
solidus_core-2.2.0.rc1 db/migrate/20130509115210_add_number_to_stock_transfer.rb
solidus_core-2.2.0.beta1 db/migrate/20130509115210_add_number_to_stock_transfer.rb
solidus_core-2.1.0 db/migrate/20130509115210_add_number_to_stock_transfer.rb
solidus_core-2.1.0.rc1 db/migrate/20130509115210_add_number_to_stock_transfer.rb
solidus_core-2.0.1 db/migrate/20130509115210_add_number_to_stock_transfer.rb
solidus_core-2.1.0.beta1 db/migrate/20130509115210_add_number_to_stock_transfer.rb
solidus_core-2.0.0 db/migrate/20130509115210_add_number_to_stock_transfer.rb
solidus_core-2.0.0.rc1 db/migrate/20130509115210_add_number_to_stock_transfer.rb