Skip to content

Commit

Permalink
Fix migration issue where default column doesnt exist yet.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeff Dutil authored and Jeff Dutil committed Oct 30, 2014
1 parent 237b411 commit 5ca23cc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 4 additions & 1 deletion core/db/migrate/20130213191427_create_default_stock.rb
@@ -1,5 +1,9 @@
class CreateDefaultStock < ActiveRecord::Migration
def up
unless column_exists? :spree_stock_locations, :default
add_column :spree_stock_locations, :default, :boolean, null: false, default: false
end

Spree::StockLocation.skip_callback(:create, :after, :create_stock_items)
Spree::StockLocation.skip_callback(:save, :after, :ensure_one_default)
Spree::StockItem.skip_callback(:save, :after, :process_backorders)
Expand Down Expand Up @@ -28,4 +32,3 @@ def down
Spree::StockItem.delete_all
end
end

@@ -1,5 +1,7 @@
class AddDefaultToSpreeStockLocations < ActiveRecord::Migration
def change
add_column :spree_stock_locations, :default, :boolean, null: false, default: false
unless column_exists? :spree_stock_locations, :default
add_column :spree_stock_locations, :default, :boolean, null: false, default: false
end
end
end

0 comments on commit 5ca23cc

Please sign in to comment.