Skip to content

Commit 2b14fc2

Browse files
Update Spree
1 parent 207726d commit 2b14fc2

5 files changed

+87
-8
lines changed

Gemfile.lock

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
GIT
22
remote: https://github.com/spree/spree.git
3-
revision: 138a1ad5bc79fd25fc6abd3b7f4847d6719c0770
3+
revision: fd9927c332b634699fee9f19fd400e7098f993b1
44
branch: main
55
specs:
66
spree (5.0.0.alpha)
@@ -293,19 +293,19 @@ GEM
293293
csv (>= 3.0.0)
294294
globalid (1.2.1)
295295
activesupport (>= 6.1)
296-
google-protobuf (4.30.0)
296+
google-protobuf (4.30.1)
297297
bigdecimal
298298
rake (>= 13)
299-
google-protobuf (4.30.0-aarch64-linux)
299+
google-protobuf (4.30.1-aarch64-linux)
300300
bigdecimal
301301
rake (>= 13)
302-
google-protobuf (4.30.0-arm64-darwin)
302+
google-protobuf (4.30.1-arm64-darwin)
303303
bigdecimal
304304
rake (>= 13)
305-
google-protobuf (4.30.0-x86_64-darwin)
305+
google-protobuf (4.30.1-x86_64-darwin)
306306
bigdecimal
307307
rake (>= 13)
308-
google-protobuf (4.30.0-x86_64-linux)
308+
google-protobuf (4.30.1-x86_64-linux)
309309
bigdecimal
310310
rake (>= 13)
311311
groupdate (6.5.1)
@@ -368,7 +368,7 @@ GEM
368368
libv8-node (23.6.1.0-x86_64-darwin)
369369
libv8-node (23.6.1.0-x86_64-linux)
370370
libv8-node (23.6.1.0-x86_64-linux-musl)
371-
local_time (3.0.2)
371+
local_time (3.0.3)
372372
logger (1.6.6)
373373
loofah (2.24.0)
374374
crass (~> 1.0.2)
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# This migration comes from spree (originally 20250312202705)
2+
class AddUniqueIndexOnPromotionRulesAssociations < ActiveRecord::Migration[7.2]
3+
def change
4+
# Remove duplicate product promotion rules
5+
execute <<-SQL
6+
DELETE FROM spree_product_promotion_rules
7+
WHERE id NOT IN (
8+
SELECT MIN(id)
9+
FROM spree_product_promotion_rules
10+
GROUP BY product_id, promotion_rule_id
11+
);
12+
SQL
13+
14+
# Remove duplicate taxon promotion rules
15+
execute <<-SQL
16+
DELETE FROM spree_promotion_rule_taxons
17+
WHERE id NOT IN (
18+
SELECT MIN(id)
19+
FROM spree_promotion_rule_taxons
20+
GROUP BY taxon_id, promotion_rule_id
21+
);
22+
SQL
23+
24+
# Remove duplicate user promotion rules
25+
execute <<-SQL
26+
DELETE FROM spree_promotion_rule_users
27+
WHERE id NOT IN (
28+
SELECT MIN(id)
29+
FROM spree_promotion_rule_users
30+
GROUP BY user_id, promotion_rule_id
31+
);
32+
SQL
33+
34+
add_index :spree_product_promotion_rules, [:product_id, :promotion_rule_id], unique: true
35+
add_index :spree_promotion_rule_taxons, [:taxon_id, :promotion_rule_id], unique: true
36+
add_index :spree_promotion_rule_users, [:user_id, :promotion_rule_id], unique: true
37+
end
38+
end
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# This migration comes from spree (originally 20250313104226)
2+
class AddUserTypeToSpreeRoleUsers < ActiveRecord::Migration[6.1]
3+
def up
4+
unless column_exists?(:spree_role_users, :user_type)
5+
add_column :spree_role_users, :user_type, :string
6+
add_index :spree_role_users, :user_type
7+
8+
user_class_name = Spree.admin_user_class.to_s
9+
Spree::RoleUser.where(user_type: nil).update_all(user_type: user_class_name)
10+
11+
change_column_null :spree_role_users, :user_type, false
12+
end
13+
end
14+
15+
def down
16+
remove_index :spree_role_users, :user_type, if_exists: true
17+
remove_column :spree_role_users, :user_type, if_exists: true
18+
end
19+
end
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# This migration comes from spree (originally 20250313175830)
2+
class AddUniqueIndexOnPromotionActionLineItems < ActiveRecord::Migration[7.2]
3+
def change
4+
# Remove duplicate promotion action line items
5+
execute <<-SQL
6+
DELETE FROM spree_promotion_action_line_items
7+
WHERE id NOT IN (
8+
SELECT MIN(id)
9+
FROM spree_promotion_action_line_items
10+
GROUP BY promotion_action_id, variant_id
11+
);
12+
SQL
13+
14+
add_index :spree_promotion_action_line_items, [:promotion_action_id, :variant_id], unique: true
15+
end
16+
end

db/schema.rb

Lines changed: 7 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)