spree_waiting_list 2.3.3 → 2.3.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c305dc7d9b374eed545dfb74cc2ec7b630bddea3
4
- data.tar.gz: 31fd58246479ab7448db7f0ff48096b742efde37
3
+ metadata.gz: 8382ccc1ea25d8f442b50687511296ecce750f8f
4
+ data.tar.gz: 9e238dd68a1319a5ba3f46535e5280ebeaafa856
5
5
  SHA512:
6
- metadata.gz: 47caac25c7b726b29deddc3579db3d19efd7e4154004c535790e7b18c57bdf48722fa1d71ad529512a670a07f5ea0eef9dd9a13a30b9481f00a802fa5d6cd7f9
7
- data.tar.gz: 6270a821a131de2968679931ac39fcad60c3c1b7dd01313a8df99621b7e0393bfaa6a0a9d0531ca7c9167bccbfa87f9565aea602df38baabbb9ccba2a06e62c8
6
+ metadata.gz: da61f6aee0d6394170e747006b758975755d424f2a8458c068ff84e03802f2a2845aae2a895bba62e4fbbff647635b8f35e08b3a5dc14ce2c4f19710f134af2c
7
+ data.tar.gz: 625369177cfed986b0b44e0055f91aa9eb3f213e5d90aee8546a30ab2cf250d87478376467c23e547552a7f46d265ad48f2cdcdd07eff20a389428126f8f6654
@@ -1,5 +1,42 @@
1
1
  class RemoveProductFromStockRequest < ActiveRecord::Migration
2
2
  def change
3
- remove_column :spree_stock_requests, :product_id
3
+ reversible do |dir|
4
+ dir.up do
5
+ execute <<-SQL
6
+ UPDATE SPREE_STOCK_REQUESTS SR
7
+ SET VARIANT_ID = SR_IN.VARIANT_ID
8
+ FROM (
9
+ SELECT
10
+ STOCK_REQUESTS.ID,
11
+ VARIANTS.ID AS VARIANT_ID
12
+ FROM SPREE_STOCK_REQUESTS STOCK_REQUESTS
13
+ INNER JOIN SPREE_PRODUCTS PRODUCTS
14
+ ON STOCK_REQUESTS.PRODUCT_ID = PRODUCTS.ID
15
+ INNER JOIN SPREE_VARIANTS VARIANTS
16
+ ON VARIANTS.PRODUCT_ID = PRODUCTS.ID
17
+ AND VARIANTS.IS_MASTER = TRUE
18
+ ) AS SR_IN
19
+ WHERE SR.VARIANT_ID IS NULL
20
+ AND SR.ID = SR_IN.ID
21
+ SQL
22
+ end
23
+ dir.down do
24
+ execute <<-SQL
25
+ UPDATE SPREE_STOCK_REQUESTS SR
26
+ SET PRODUCT_ID = REQUESTS.PRODUCT_ID
27
+ FROM (
28
+ SELECT
29
+ STOCK_REQUESTS.ID,
30
+ VARIANTS.PRODUCT_ID
31
+ FROM SPREE_STOCK_REQUESTS AS STOCK_REQUESTS
32
+ INNER JOIN SPREE_VARIANTS AS VARIANTS
33
+ ON STOCK_REQUESTS.VARIANT_ID = VARIANTS.ID
34
+ ) AS REQUESTS
35
+ WHERE SR.ID = REQUESTS.ID
36
+ SQL
37
+ end
38
+ end
39
+
40
+ remove_column :spree_stock_requests, :product_id, :integer
4
41
  end
5
42
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_waiting_list
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.3
4
+ version: 2.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua Nussbaum
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-07 00:00:00.000000000 Z
11
+ date: 2015-04-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: spree_core