spree_core 4.7.3 → 4.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (98) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +1 -1
  3. data/app/finders/spree/taxons/find.rb +7 -3
  4. data/app/models/concerns/spree/product_scopes.rb +19 -19
  5. data/app/models/concerns/spree/user_address.rb +4 -2
  6. data/app/models/spree/address.rb +1 -20
  7. data/app/models/spree/asset.rb +1 -1
  8. data/app/models/spree/cms_page.rb +1 -1
  9. data/app/models/spree/country.rb +0 -26
  10. data/app/models/spree/credit_card.rb +4 -2
  11. data/app/models/spree/customer_return.rb +1 -1
  12. data/app/models/spree/digital.rb +1 -1
  13. data/app/models/spree/digital_link.rb +1 -1
  14. data/app/models/spree/inventory_unit.rb +1 -1
  15. data/app/models/spree/line_item.rb +1 -1
  16. data/app/models/spree/menu.rb +1 -1
  17. data/app/models/spree/menu_item.rb +1 -1
  18. data/app/models/spree/option_type.rb +3 -3
  19. data/app/models/spree/option_value.rb +3 -3
  20. data/app/models/spree/order.rb +5 -3
  21. data/app/models/spree/payment.rb +1 -1
  22. data/app/models/spree/payment_capture_event.rb +1 -1
  23. data/app/models/spree/price.rb +3 -1
  24. data/app/models/spree/product.rb +24 -13
  25. data/app/models/spree/product_property.rb +4 -2
  26. data/app/models/spree/promotion.rb +1 -1
  27. data/app/models/spree/property.rb +6 -4
  28. data/app/models/spree/prototype.rb +1 -1
  29. data/app/models/spree/refund.rb +1 -1
  30. data/app/models/spree/reimbursement.rb +1 -1
  31. data/app/models/spree/return_authorization.rb +1 -1
  32. data/app/models/spree/return_item.rb +1 -1
  33. data/app/models/spree/shipment.rb +1 -1
  34. data/app/models/spree/shipping_category.rb +1 -1
  35. data/app/models/spree/shipping_method.rb +1 -1
  36. data/app/models/spree/stock_item.rb +2 -2
  37. data/app/models/spree/stock_location.rb +6 -1
  38. data/app/models/spree/stock_movement.rb +1 -1
  39. data/app/models/spree/stock_transfer.rb +1 -1
  40. data/app/models/spree/store.rb +2 -4
  41. data/app/models/spree/store_credit.rb +1 -1
  42. data/app/models/spree/store_favicon_image.rb +11 -2
  43. data/app/models/spree/tax_category.rb +1 -1
  44. data/app/models/spree/tax_rate.rb +1 -1
  45. data/app/models/spree/taxon.rb +20 -4
  46. data/app/models/spree/taxonomy.rb +3 -3
  47. data/app/models/spree/variant.rb +9 -4
  48. data/app/models/spree/wished_item.rb +1 -1
  49. data/app/models/spree/wishlist.rb +1 -1
  50. data/app/models/spree/zone.rb +1 -1
  51. data/app/services/spree/addresses/update.rb +1 -0
  52. data/app/services/spree/seeds/all.rb +15 -13
  53. data/app/services/spree/seeds/stores.rb +2 -2
  54. data/app/sorters/spree/products/sort.rb +1 -1
  55. data/config/initializers/mobility.rb +1 -0
  56. data/config/routes.rb +7 -8
  57. data/db/migrate/20210929090344_create_stock_item_stock_location_id_variant_id_coalesce_deleted_at_unique_index.rb +1 -28
  58. data/db/migrate/20230103144439_create_option_type_translations.rb +0 -1
  59. data/db/migrate/20230103151034_create_option_value_translations.rb +0 -1
  60. data/db/migrate/20230109084253_create_product_property_translations.rb +0 -1
  61. data/db/migrate/20230109105943_create_property_translations.rb +0 -2
  62. data/db/migrate/20230110142344_backfill_friendly_id_slug_locale.rb +2 -8
  63. data/db/migrate/20240303174340_fix_spree_stock_item_unique_index.rb +35 -0
  64. data/db/migrate/20240514105216_add_weight_and_dimension_units_to_spree_variants.rb +6 -0
  65. data/lib/generators/spree/custom_authentication/custom_authentication_generator.rb +23 -0
  66. data/lib/generators/spree/{custom_user → custom_authentication}/templates/authentication_helpers.rb.tt +1 -14
  67. data/lib/generators/spree/custom_user/custom_user_generator.rb +3 -8
  68. data/lib/generators/spree/custom_user/templates/current_user_helpers.rb.tt +15 -0
  69. data/lib/generators/spree/custom_user/templates/migration.rb.tt +2 -2
  70. data/lib/generators/spree/dummy/dummy_generator.rb +1 -6
  71. data/lib/generators/spree/dummy/templates/rails/database.yml +19 -21
  72. data/lib/generators/spree/dummy/templates/rails/test.rb +1 -1
  73. data/lib/generators/spree/install/templates/config/initializers/spree.rb +25 -0
  74. data/lib/spree/core/configuration.rb +11 -25
  75. data/lib/spree/core/controller_helpers/locale.rb +5 -1
  76. data/lib/spree/core/engine.rb +4 -1
  77. data/lib/spree/core/preferences/runtime_configuration.rb +43 -0
  78. data/lib/spree/core/product_duplicator.rb +2 -0
  79. data/lib/spree/core/product_filters.rb +9 -2
  80. data/lib/spree/core/runtime_configuration.rb +9 -0
  81. data/lib/spree/core/version.rb +1 -1
  82. data/lib/spree/core/webhooks.rb +13 -0
  83. data/lib/spree/core.rb +7 -0
  84. data/lib/spree/money.rb +38 -5
  85. data/lib/spree/testing_support/authorization_helpers.rb +3 -1
  86. data/lib/spree/testing_support/common_rake.rb +7 -18
  87. data/spree_core.gemspec +7 -7
  88. metadata +47 -50
  89. data/db/migrate/20220715120222_change_product_name_null_to_true.rb +0 -5
  90. data/db/migrate/20220718100948_change_taxon_name_null_to_true.rb +0 -5
  91. data/db/migrate/20220804073928_transfer_data_to_translatable_tables.rb +0 -66
  92. data/db/migrate/20230109094907_transfer_options_data_to_translatable_tables.rb +0 -58
  93. data/db/migrate/20230109110840_transfer_property_data_to_translatable_tables.rb +0 -59
  94. data/db/migrate/20230111122511_transfer_product_and_taxon_data_to_translatable_tables.rb +0 -82
  95. data/db/migrate/20230117120430_allow_null_taxonomy_name.rb +0 -5
  96. data/db/migrate/20230117121303_transfer_taxonomy_data_to_translatable_tables.rb +0 -11
  97. data/db/migrate/20230210142849_transfer_store_data_to_translatable_tables.rb +0 -11
  98. data/db/migrate/20230514162157_add_index_on_locale_and_permalink_to_spree_taxons.rb +0 -5
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.7.3
4
+ version: 4.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Schofield
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2024-04-24 00:00:00.000000000 Z
12
+ date: 2024-05-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: actionpack
@@ -20,7 +20,7 @@ dependencies:
20
20
  version: '6.1'
21
21
  - - "<"
22
22
  - !ruby/object:Gem::Version
23
- version: '7.2'
23
+ version: '8.0'
24
24
  type: :runtime
25
25
  prerelease: false
26
26
  version_requirements: !ruby/object:Gem::Requirement
@@ -30,7 +30,7 @@ dependencies:
30
30
  version: '6.1'
31
31
  - - "<"
32
32
  - !ruby/object:Gem::Version
33
- version: '7.2'
33
+ version: '8.0'
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: actionview
36
36
  requirement: !ruby/object:Gem::Requirement
@@ -40,7 +40,7 @@ dependencies:
40
40
  version: '6.1'
41
41
  - - "<"
42
42
  - !ruby/object:Gem::Version
43
- version: '7.2'
43
+ version: '8.0'
44
44
  type: :runtime
45
45
  prerelease: false
46
46
  version_requirements: !ruby/object:Gem::Requirement
@@ -50,7 +50,7 @@ dependencies:
50
50
  version: '6.1'
51
51
  - - "<"
52
52
  - !ruby/object:Gem::Version
53
- version: '7.2'
53
+ version: '8.0'
54
54
  - !ruby/object:Gem::Dependency
55
55
  name: activejob
56
56
  requirement: !ruby/object:Gem::Requirement
@@ -60,7 +60,7 @@ dependencies:
60
60
  version: '6.1'
61
61
  - - "<"
62
62
  - !ruby/object:Gem::Version
63
- version: '7.2'
63
+ version: '8.0'
64
64
  type: :runtime
65
65
  prerelease: false
66
66
  version_requirements: !ruby/object:Gem::Requirement
@@ -70,7 +70,7 @@ dependencies:
70
70
  version: '6.1'
71
71
  - - "<"
72
72
  - !ruby/object:Gem::Version
73
- version: '7.2'
73
+ version: '8.0'
74
74
  - !ruby/object:Gem::Dependency
75
75
  name: activemodel
76
76
  requirement: !ruby/object:Gem::Requirement
@@ -80,7 +80,7 @@ dependencies:
80
80
  version: '6.1'
81
81
  - - "<"
82
82
  - !ruby/object:Gem::Version
83
- version: '7.2'
83
+ version: '8.0'
84
84
  type: :runtime
85
85
  prerelease: false
86
86
  version_requirements: !ruby/object:Gem::Requirement
@@ -90,7 +90,7 @@ dependencies:
90
90
  version: '6.1'
91
91
  - - "<"
92
92
  - !ruby/object:Gem::Version
93
- version: '7.2'
93
+ version: '8.0'
94
94
  - !ruby/object:Gem::Dependency
95
95
  name: activerecord
96
96
  requirement: !ruby/object:Gem::Requirement
@@ -100,7 +100,7 @@ dependencies:
100
100
  version: '6.1'
101
101
  - - "<"
102
102
  - !ruby/object:Gem::Version
103
- version: '7.2'
103
+ version: '8.0'
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
@@ -110,7 +110,7 @@ dependencies:
110
110
  version: '6.1'
111
111
  - - "<"
112
112
  - !ruby/object:Gem::Version
113
- version: '7.2'
113
+ version: '8.0'
114
114
  - !ruby/object:Gem::Dependency
115
115
  name: activestorage
116
116
  requirement: !ruby/object:Gem::Requirement
@@ -120,7 +120,7 @@ dependencies:
120
120
  version: '6.1'
121
121
  - - "<"
122
122
  - !ruby/object:Gem::Version
123
- version: '7.2'
123
+ version: '8.0'
124
124
  type: :runtime
125
125
  prerelease: false
126
126
  version_requirements: !ruby/object:Gem::Requirement
@@ -130,7 +130,7 @@ dependencies:
130
130
  version: '6.1'
131
131
  - - "<"
132
132
  - !ruby/object:Gem::Version
133
- version: '7.2'
133
+ version: '8.0'
134
134
  - !ruby/object:Gem::Dependency
135
135
  name: activesupport
136
136
  requirement: !ruby/object:Gem::Requirement
@@ -140,7 +140,7 @@ dependencies:
140
140
  version: '6.1'
141
141
  - - "<"
142
142
  - !ruby/object:Gem::Version
143
- version: '7.2'
143
+ version: '8.0'
144
144
  type: :runtime
145
145
  prerelease: false
146
146
  version_requirements: !ruby/object:Gem::Requirement
@@ -150,7 +150,7 @@ dependencies:
150
150
  version: '6.1'
151
151
  - - "<"
152
152
  - !ruby/object:Gem::Version
153
- version: '7.2'
153
+ version: '8.0'
154
154
  - !ruby/object:Gem::Dependency
155
155
  name: railties
156
156
  requirement: !ruby/object:Gem::Requirement
@@ -160,7 +160,7 @@ dependencies:
160
160
  version: '6.1'
161
161
  - - "<"
162
162
  - !ruby/object:Gem::Version
163
- version: '7.2'
163
+ version: '8.0'
164
164
  type: :runtime
165
165
  prerelease: false
166
166
  version_requirements: !ruby/object:Gem::Requirement
@@ -170,7 +170,7 @@ dependencies:
170
170
  version: '6.1'
171
171
  - - "<"
172
172
  - !ruby/object:Gem::Version
173
- version: '7.2'
173
+ version: '8.0'
174
174
  - !ruby/object:Gem::Dependency
175
175
  name: activemerchant
176
176
  requirement: !ruby/object:Gem::Requirement
@@ -285,16 +285,22 @@ dependencies:
285
285
  name: highline
286
286
  requirement: !ruby/object:Gem::Requirement
287
287
  requirements:
288
- - - "~>"
288
+ - - ">="
289
+ - !ruby/object:Gem::Version
290
+ version: '2'
291
+ - - "<"
289
292
  - !ruby/object:Gem::Version
290
- version: '2.0'
293
+ version: '4'
291
294
  type: :runtime
292
295
  prerelease: false
293
296
  version_requirements: !ruby/object:Gem::Requirement
294
297
  requirements:
295
- - - "~>"
298
+ - - ">="
299
+ - !ruby/object:Gem::Version
300
+ version: '2'
301
+ - - "<"
296
302
  - !ruby/object:Gem::Version
297
- version: '2.0'
303
+ version: '4'
298
304
  - !ruby/object:Gem::Dependency
299
305
  name: kaminari
300
306
  requirement: !ruby/object:Gem::Requirement
@@ -455,20 +461,14 @@ dependencies:
455
461
  requirements:
456
462
  - - "~>"
457
463
  - !ruby/object:Gem::Version
458
- version: '0.9'
459
- - - "<="
460
- - !ruby/object:Gem::Version
461
- version: 0.9.5
464
+ version: '1.1'
462
465
  type: :runtime
463
466
  prerelease: false
464
467
  version_requirements: !ruby/object:Gem::Requirement
465
468
  requirements:
466
469
  - - "~>"
467
470
  - !ruby/object:Gem::Version
468
- version: '0.9'
469
- - - "<="
470
- - !ruby/object:Gem::Version
471
- version: 0.9.5
471
+ version: '1.1'
472
472
  - !ruby/object:Gem::Dependency
473
473
  name: activerecord-typedstore
474
474
  requirement: !ruby/object:Gem::Requirement
@@ -489,42 +489,42 @@ dependencies:
489
489
  requirements:
490
490
  - - "~>"
491
491
  - !ruby/object:Gem::Version
492
- version: 1.2.9
492
+ version: '1.2'
493
493
  type: :runtime
494
494
  prerelease: false
495
495
  version_requirements: !ruby/object:Gem::Requirement
496
496
  requirements:
497
497
  - - "~>"
498
498
  - !ruby/object:Gem::Version
499
- version: 1.2.9
499
+ version: '1.2'
500
500
  - !ruby/object:Gem::Dependency
501
501
  name: mobility-ransack
502
502
  requirement: !ruby/object:Gem::Requirement
503
503
  requirements:
504
504
  - - "~>"
505
505
  - !ruby/object:Gem::Version
506
- version: 1.2.1
506
+ version: '1.2'
507
507
  type: :runtime
508
508
  prerelease: false
509
509
  version_requirements: !ruby/object:Gem::Requirement
510
510
  requirements:
511
511
  - - "~>"
512
512
  - !ruby/object:Gem::Version
513
- version: 1.2.1
513
+ version: '1.2'
514
514
  - !ruby/object:Gem::Dependency
515
515
  name: friendly_id-mobility
516
516
  requirement: !ruby/object:Gem::Requirement
517
517
  requirements:
518
518
  - - "~>"
519
519
  - !ruby/object:Gem::Version
520
- version: 1.0.4
520
+ version: '1.0'
521
521
  type: :runtime
522
522
  prerelease: false
523
523
  version_requirements: !ruby/object:Gem::Requirement
524
524
  requirements:
525
525
  - - "~>"
526
526
  - !ruby/object:Gem::Version
527
- version: 1.0.4
527
+ version: '1.0'
528
528
  description: Spree Models, Helpers, Services and core libraries
529
529
  email: hello@spreecommerce.org
530
530
  executables: []
@@ -917,12 +917,9 @@ files:
917
917
  - db/migrate/20220613133029_add_metadata_to_spree_stock_items.rb
918
918
  - db/migrate/20220706112554_create_product_name_and_description_translations_for_mobility_table_backend.rb
919
919
  - db/migrate/20220715083542_create_spree_product_translations_for_mobility.rb
920
- - db/migrate/20220715120222_change_product_name_null_to_true.rb
921
920
  - db/migrate/20220718100743_create_spree_taxon_name_and_description_translations_for_mobility_table_backend.rb
922
- - db/migrate/20220718100948_change_taxon_name_null_to_true.rb
923
921
  - db/migrate/20220802070609_add_locale_to_friendly_id_slugs.rb
924
922
  - db/migrate/20220802073225_create_spree_product_slug_translations_for_mobility_table_backend.rb
925
- - db/migrate/20220804073928_transfer_data_to_translatable_tables.rb
926
923
  - db/migrate/20221215151408_add_selected_locale_to_spree_users.rb
927
924
  - db/migrate/20221219123957_add_deleted_at_to_product_translations.rb
928
925
  - db/migrate/20221220133432_add_uniqueness_constraint_to_product_translations.rb
@@ -930,27 +927,24 @@ files:
930
927
  - db/migrate/20230103144439_create_option_type_translations.rb
931
928
  - db/migrate/20230103151034_create_option_value_translations.rb
932
929
  - db/migrate/20230109084253_create_product_property_translations.rb
933
- - db/migrate/20230109094907_transfer_options_data_to_translatable_tables.rb
934
930
  - db/migrate/20230109105943_create_property_translations.rb
935
- - db/migrate/20230109110840_transfer_property_data_to_translatable_tables.rb
936
931
  - db/migrate/20230110142344_backfill_friendly_id_slug_locale.rb
937
932
  - db/migrate/20230111121534_add_additional_taxon_translation_fields.rb
938
- - db/migrate/20230111122511_transfer_product_and_taxon_data_to_translatable_tables.rb
939
933
  - db/migrate/20230117115531_create_taxonomy_translations.rb
940
- - db/migrate/20230117120430_allow_null_taxonomy_name.rb
941
- - db/migrate/20230117121303_transfer_taxonomy_data_to_translatable_tables.rb
942
934
  - db/migrate/20230210142732_create_store_translations.rb
943
- - db/migrate/20230210142849_transfer_store_data_to_translatable_tables.rb
944
935
  - db/migrate/20230210230434_add_deleted_at_to_store_translations.rb
945
936
  - db/migrate/20230415155958_rename_data_feed_settings_table.rb
946
937
  - db/migrate/20230415160828_rename_data_feed_table_columns.rb
947
938
  - db/migrate/20230415161226_add_indexes_to_data_feeds_table.rb
948
939
  - db/migrate/20230512094803_rename_data_feeds_column_provider_to_type.rb
949
- - db/migrate/20230514162157_add_index_on_locale_and_permalink_to_spree_taxons.rb
940
+ - db/migrate/20240303174340_fix_spree_stock_item_unique_index.rb
941
+ - db/migrate/20240514105216_add_weight_and_dimension_units_to_spree_variants.rb
950
942
  - db/seeds.rb
951
943
  - lib/friendly_id/paranoia.rb
944
+ - lib/generators/spree/custom_authentication/custom_authentication_generator.rb
945
+ - lib/generators/spree/custom_authentication/templates/authentication_helpers.rb.tt
952
946
  - lib/generators/spree/custom_user/custom_user_generator.rb
953
- - lib/generators/spree/custom_user/templates/authentication_helpers.rb.tt
947
+ - lib/generators/spree/custom_user/templates/current_user_helpers.rb.tt
954
948
  - lib/generators/spree/custom_user/templates/initializer.rb.tt
955
949
  - lib/generators/spree/custom_user/templates/migration.rb.tt
956
950
  - lib/generators/spree/dummy/dummy_generator.rb
@@ -989,6 +983,7 @@ files:
989
983
  - lib/spree/core/preferences/configuration.rb
990
984
  - lib/spree/core/preferences/preferable.rb
991
985
  - lib/spree/core/preferences/preferable_class_methods.rb
986
+ - lib/spree/core/preferences/runtime_configuration.rb
992
987
  - lib/spree/core/preferences/scoped_store.rb
993
988
  - lib/spree/core/preferences/store.rb
994
989
  - lib/spree/core/product_duplicator.rb
@@ -999,9 +994,11 @@ files:
999
994
  - lib/spree/core/query_filters/number.rb
1000
995
  - lib/spree/core/query_filters/text.rb
1001
996
  - lib/spree/core/routes.rb
997
+ - lib/spree/core/runtime_configuration.rb
1002
998
  - lib/spree/core/search/base.rb
1003
999
  - lib/spree/core/token_generator.rb
1004
1000
  - lib/spree/core/version.rb
1001
+ - lib/spree/core/webhooks.rb
1005
1002
  - lib/spree/database_type_utilities.rb
1006
1003
  - lib/spree/i18n.rb
1007
1004
  - lib/spree/localized_number.rb
@@ -1122,9 +1119,9 @@ licenses:
1122
1119
  - BSD-3-Clause
1123
1120
  metadata:
1124
1121
  bug_tracker_uri: https://github.com/spree/spree/issues
1125
- changelog_uri: https://github.com/spree/spree/releases/tag/v4.7.3
1126
- documentation_uri: https://dev-docs.spreecommerce.org/
1127
- source_code_uri: https://github.com/spree/spree/tree/v4.7.3
1122
+ changelog_uri: https://github.com/spree/spree/releases/tag/v4.8.0
1123
+ documentation_uri: https://docs.spreecommerce.org/
1124
+ source_code_uri: https://github.com/spree/spree/tree/v4.8.0
1128
1125
  post_install_message:
1129
1126
  rdoc_options: []
1130
1127
  require_paths:
@@ -1,5 +0,0 @@
1
- class ChangeProductNameNullToTrue < ActiveRecord::Migration[6.1]
2
- def change
3
- change_column_null :spree_products, :name, true
4
- end
5
- end
@@ -1,5 +0,0 @@
1
- class ChangeTaxonNameNullToTrue < ActiveRecord::Migration[6.1]
2
- def change
3
- change_column_null :spree_taxons, :name, true
4
- end
5
- end
@@ -1,66 +0,0 @@
1
- class TransferDataToTranslatableTables < ActiveRecord::Migration[6.1]
2
- DEFAULT_LOCALE = 'en'
3
- PRODUCTS_TABLE = 'spree_products'
4
- PRODUCT_TRANSLATIONS_TABLE = 'spree_product_translations'
5
- TAXONS_TABLE = 'spree_taxons'
6
- TAXON_TRANSLATIONS_TABLE = 'spree_taxon_translations'
7
-
8
- def up
9
- # Products
10
- ActiveRecord::Base.connection.execute("
11
- INSERT INTO #{PRODUCT_TRANSLATIONS_TABLE} (name, description, locale, spree_product_id, created_at, updated_at, meta_description, meta_keywords, meta_title, slug)
12
- SELECT name, description, '#{DEFAULT_LOCALE}' as locale, id, created_at, updated_at, meta_description, meta_keywords, meta_title, slug FROM #{PRODUCTS_TABLE}
13
- ")
14
- ActiveRecord::Base.connection.execute("
15
- UPDATE #{PRODUCTS_TABLE}
16
- SET name=null, description=null, meta_description=null, meta_keywords=null, meta_title=null, slug=null;
17
- ")
18
- #Taxons
19
- ActiveRecord::Base.connection.execute("
20
- INSERT INTO #{TAXON_TRANSLATIONS_TABLE} (name, description, locale, spree_taxon_id, created_at, updated_at)
21
- SELECT name, description, '#{DEFAULT_LOCALE}' as locale, id, created_at, updated_at FROM #{TAXONS_TABLE}
22
- ")
23
- ActiveRecord::Base.connection.execute("
24
- UPDATE #{TAXONS_TABLE}
25
- SET name=null, description=null
26
- ")
27
- end
28
-
29
- def down
30
- ActiveRecord::Base.connection.execute("
31
- UPDATE #{PRODUCTS_TABLE} as products
32
- SET (name,
33
- description,
34
- meta_description,
35
- meta_keywords,
36
- meta_title,
37
- slug) =
38
- (t_products.name,
39
- t_products.description,
40
- t_products.meta_description,
41
- t_products.meta_keywords,
42
- t_products.meta_title,
43
- t_products.slug)
44
- FROM #{PRODUCT_TRANSLATIONS_TABLE} AS t_products
45
- WHERE t_products.spree_product_id = products.id
46
- ")
47
-
48
- ActiveRecord::Base.connection.execute("
49
- TRUNCATE TABLE #{PRODUCT_TRANSLATIONS_TABLE}
50
- ")
51
-
52
- ActiveRecord::Base.connection.execute("
53
- UPDATE #{TAXONS_TABLE} as taxons
54
- SET (name,
55
- description) =
56
- (t_taxons.name,
57
- t_taxons.description)
58
- FROM #{TAXON_TRANSLATIONS_TABLE} AS t_taxons
59
- WHERE t_taxons.spree_taxon_id = taxons.id
60
- ")
61
-
62
- ActiveRecord::Base.connection.execute("
63
- TRUNCATE TABLE #{TAXON_TRANSLATIONS_TABLE}
64
- ")
65
- end
66
- end
@@ -1,58 +0,0 @@
1
- class TransferOptionsDataToTranslatableTables < ActiveRecord::Migration[6.1]
2
- DEFAULT_LOCALE = 'en'
3
-
4
- def up
5
- # Only transfer data if translation tables are being newly created / no translations exist
6
- # Otherwise, assume translation data is already in place from spree_globalize
7
-
8
- # Option Types
9
- if not Spree::OptionType::Translation.exists?
10
- ActiveRecord::Base.connection.execute("
11
- INSERT INTO spree_option_type_translations (name, presentation, locale, spree_option_type_id, created_at, updated_at)
12
- SELECT name, presentation, '#{DEFAULT_LOCALE}', id, created_at, updated_at
13
- FROM spree_option_types;
14
- ")
15
- ActiveRecord::Base.connection.execute("
16
- UPDATE spree_option_types
17
- SET name=null, presentation=null;
18
- ")
19
- end
20
-
21
- # Option Values
22
- if not Spree::OptionValue::Translation.exists?
23
- ActiveRecord::Base.connection.execute("
24
- INSERT INTO spree_option_value_translations (name, presentation, locale, spree_option_value_id, created_at, updated_at)
25
- SELECT name, presentation, '#{DEFAULT_LOCALE}', id, created_at, updated_at
26
- FROM spree_option_values;
27
- ")
28
- ActiveRecord::Base.connection.execute("
29
- UPDATE spree_option_values
30
- SET name=null, presentation=null;
31
- ")
32
- end
33
- end
34
-
35
- def down
36
- # Option Types
37
- ActiveRecord::Base.connection.execute("
38
- UPDATE spree_option_types as option_types
39
- SET (name, presentation) = (t_option_types.name, t_option_types.presentation)
40
- FROM spree_option_type_translations AS t_option_types
41
- WHERE t_option_types.spree_option_type_id = option_types.id;
42
- ")
43
- ActiveRecord::Base.connection.execute("
44
- TRUNCATE TABLE spree_option_type_translations;
45
- ")
46
-
47
- # Option Values
48
- ActiveRecord::Base.connection.execute("
49
- UPDATE spree_option_values as option_values
50
- SET (name, presentation) = (t_option_values.name, t_option_values.presentation)
51
- FROM spree_option_value_translations AS t_option_values
52
- WHERE t_option_values.spree_option_value_id = option_values.id;
53
- ")
54
- ActiveRecord::Base.connection.execute("
55
- TRUNCATE TABLE spree_option_value_translations;
56
- ")
57
- end
58
- end
@@ -1,59 +0,0 @@
1
- class TransferPropertyDataToTranslatableTables < ActiveRecord::Migration[6.1]
2
- DEFAULT_LOCALE = 'en'
3
-
4
- def up
5
- # Properties
6
- change_column_null :spree_properties, :presentation, true
7
-
8
- if not Spree::Property::Translation.exists?
9
- ActiveRecord::Base.connection.execute("
10
- INSERT INTO spree_property_translations (name, presentation, filter_param, locale, spree_property_id, created_at, updated_at)
11
- SELECT name, presentation, filter_param, '#{DEFAULT_LOCALE}', id, created_at, updated_at
12
- FROM spree_properties;
13
- ")
14
- ActiveRecord::Base.connection.execute("
15
- UPDATE spree_properties
16
- SET name=null, presentation=null, filter_param=null;
17
- ")
18
- end
19
-
20
- # Product Properties
21
- if not Spree::ProductProperty::Translation.exists?
22
- ActiveRecord::Base.connection.execute("
23
- INSERT INTO spree_product_property_translations (value, filter_param, locale, spree_product_property_id, created_at, updated_at)
24
- SELECT value, filter_param, '#{DEFAULT_LOCALE}', id, created_at, updated_at
25
- FROM spree_product_properties;
26
- ")
27
- ActiveRecord::Base.connection.execute("
28
- UPDATE spree_product_properties
29
- SET value=null, filter_param=null;
30
- ")
31
- end
32
- end
33
-
34
- def down
35
- # Properties
36
- change_column_null :spree_properties, :presentation, false
37
-
38
- ActiveRecord::Base.connection.execute("
39
- UPDATE spree_properties AS properties
40
- SET (name, presentation, filter_param) = (t_properties.name, t_properties.presentation, t_properties.filter_param)
41
- FROM spree_property_translations AS t_properties
42
- WHERE t_properties.spree_property_id = properties.id;
43
- ")
44
- ActiveRecord::Base.connection.execute("
45
- TRUNCATE TABLE spree_property_translations;
46
- ")
47
-
48
- # Product Properties
49
- ActiveRecord::Base.connection.execute("
50
- UPDATE spree_product_properties AS product_properties
51
- SET (value, filter_param) = (t_product_properties.value, t_product_properties.filter_param)
52
- FROM spree_product_property_translations AS t_product_properties
53
- WHERE t_product_properties.spree_product_property_id = product_properties.id;
54
- ")
55
- ActiveRecord::Base.connection.execute("
56
- TRUNCATE TABLE spree_product_property_translations;
57
- ")
58
- end
59
- end
@@ -1,82 +0,0 @@
1
- class TransferProductAndTaxonDataToTranslatableTables < ActiveRecord::Migration[6.1]
2
- DEFAULT_LOCALE = 'en'
3
- PRODUCTS_TABLE = 'spree_products'
4
- PRODUCT_TRANSLATIONS_TABLE = 'spree_product_translations'
5
- TAXONS_TABLE = 'spree_taxons'
6
- TAXON_TRANSLATIONS_TABLE = 'spree_taxon_translations'
7
-
8
- def up
9
- # Only transfer data if translation tables are being newly created / no translations exist
10
- # Otherwise, assume translation data is already in place from spree_globalize
11
-
12
- # Products
13
- if not Spree::Product::Translation.exists?
14
- ActiveRecord::Base.connection.execute("
15
- INSERT INTO #{PRODUCT_TRANSLATIONS_TABLE} (name, description, locale, spree_product_id, created_at, updated_at, meta_description, meta_keywords, meta_title, slug)
16
- SELECT name, description, '#{DEFAULT_LOCALE}' as locale, id, created_at, updated_at, meta_description, meta_keywords, meta_title, slug FROM #{PRODUCTS_TABLE};
17
- ")
18
- ActiveRecord::Base.connection.execute("
19
- UPDATE #{PRODUCTS_TABLE}
20
- SET name=null, description=null, meta_description=null, meta_keywords=null, meta_title=null, slug=null;
21
- ")
22
- end
23
-
24
- # Taxons
25
- if not Spree::Taxon::Translation.exists?
26
- ActiveRecord::Base.connection.execute("
27
- INSERT INTO #{TAXON_TRANSLATIONS_TABLE} (name, description, meta_title, meta_description, meta_keywords, permalink, locale, spree_taxon_id, created_at, updated_at)
28
- SELECT name, description, meta_title, meta_description, meta_keywords, permalink, '#{DEFAULT_LOCALE}' as locale, id, created_at, updated_at FROM #{TAXONS_TABLE};
29
- ")
30
- ActiveRecord::Base.connection.execute("
31
- UPDATE #{TAXONS_TABLE}
32
- SET name=null, description=null, meta_title=null, meta_description=null, meta_keywords=null, permalink=null;
33
- ")
34
- end
35
- end
36
-
37
- def down
38
- ActiveRecord::Base.connection.execute("
39
- UPDATE #{PRODUCTS_TABLE} as products
40
- SET (name,
41
- description,
42
- meta_description,
43
- meta_keywords,
44
- meta_title,
45
- slug) =
46
- (t_products.name,
47
- t_products.description,
48
- t_products.meta_description,
49
- t_products.meta_keywords,
50
- t_products.meta_title,
51
- t_products.slug)
52
- FROM #{PRODUCT_TRANSLATIONS_TABLE} AS t_products
53
- WHERE t_products.spree_product_id = products.id
54
- ")
55
-
56
- ActiveRecord::Base.connection.execute("
57
- TRUNCATE TABLE #{PRODUCT_TRANSLATIONS_TABLE}
58
- ")
59
-
60
- ActiveRecord::Base.connection.execute("
61
- UPDATE #{TAXONS_TABLE} as taxons
62
- SET (name,
63
- description,
64
- meta_title,
65
- meta_description,
66
- meta_keywords,
67
- permalink) =
68
- (t_taxons.name,
69
- t_taxons.description,
70
- t_taxons.meta_title,
71
- t_taxons.meta_description,
72
- t_taxons.meta_keywords,
73
- t_taxons.permalink)
74
- FROM #{TAXON_TRANSLATIONS_TABLE} AS t_taxons
75
- WHERE t_taxons.spree_taxon_id = taxons.id
76
- ")
77
-
78
- ActiveRecord::Base.connection.execute("
79
- TRUNCATE TABLE #{TAXON_TRANSLATIONS_TABLE}
80
- ")
81
- end
82
- end
@@ -1,5 +0,0 @@
1
- class AllowNullTaxonomyName < ActiveRecord::Migration[6.1]
2
- def change
3
- change_column_null :spree_taxonomies, :name, true
4
- end
5
- end
@@ -1,11 +0,0 @@
1
- class TransferTaxonomyDataToTranslatableTables < ActiveRecord::Migration[6.1]
2
- TRANSLATION_MIGRATION = Spree::TranslationMigrations.new(Spree::Taxonomy, 'en')
3
-
4
- def up
5
- TRANSLATION_MIGRATION.transfer_translation_data
6
- end
7
-
8
- def down
9
- TRANSLATION_MIGRATION.revert_translation_data_transfer
10
- end
11
- end
@@ -1,11 +0,0 @@
1
- class TransferStoreDataToTranslatableTables < ActiveRecord::Migration[6.1]
2
- TRANSLATION_MIGRATION = Spree::TranslationMigrations.new(Spree::Store, 'en')
3
-
4
- def up
5
- TRANSLATION_MIGRATION.transfer_translation_data
6
- end
7
-
8
- def down
9
- TRANSLATION_MIGRATION.revert_translation_data_transfer
10
- end
11
- end
@@ -1,5 +0,0 @@
1
- class AddIndexOnLocaleAndPermalinkToSpreeTaxons < ActiveRecord::Migration[6.1]
2
- def change
3
- add_index :spree_taxon_translations, [:locale, :permalink], unique: true, name: 'unique_permalink_per_locale', if_not_exists: true
4
- end
5
- end