solidus_i18n 2.2.0 → 4.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +55 -9
- data/Rakefile +21 -10
- data/bin/rails +9 -11
- data/config/locales/da.yml +1 -1
- data/config/locales/de.yml +1 -1
- data/config/locales/es-CL.yml +1 -1
- data/config/locales/es-MX.yml +3 -3
- data/config/locales/es.yml +3 -3
- data/config/locales/fa.yml +1 -1
- data/config/locales/fr.yml +4 -4
- data/config/locales/id.yml +1 -1
- data/config/locales/it.yml +1 -1
- data/config/locales/ja.yml +2 -2
- data/config/locales/nb.yml +1 -1
- data/config/locales/nl.yml +1 -1
- data/config/locales/pl.yml +1 -1
- data/config/locales/pt-BR.yml +426 -145
- data/config/locales/ru.yml +1 -1
- data/config/locales/tr.yml +1 -1
- data/i18n-tasks.yml +22 -0
- data/lib/solidus_i18n/engine.rb +2 -12
- data/lib/solidus_i18n.rb +1 -5
- data/solidus_i18n.gemspec +30 -34
- metadata +18 -245
- data/.circleci/config.yml +0 -61
- data/.gem_release.yml +0 -5
- data/.github/stale.yml +0 -1
- data/.gitignore +0 -16
- data/.hound.yml +0 -25
- data/.rspec +0 -2
- data/.rubocop.yml +0 -4
- data/.rubocop_todo.yml +0 -18
- data/CONTRIBUTING.md +0 -70
- data/Gemfile +0 -37
- data/LICENSE +0 -26
- data/bin/console +0 -17
- data/bin/rake +0 -7
- data/bin/setup +0 -8
- data/config/routes.rb +0 -4
- data/lib/generators/solidus_i18n/install/install_generator.rb +0 -24
- data/lib/solidus_i18n/factories.rb +0 -4
- data/lib/solidus_i18n/version.rb +0 -5
- data/lib/tasks/solidus_i18n/upgrade.rake +0 -45
- data/spec/dummy/README.md +0 -24
- data/spec/dummy/Rakefile +0 -6
- data/spec/dummy/app/assets/config/manifest.js +0 -2
- data/spec/dummy/app/assets/stylesheets/application.css +0 -15
- data/spec/dummy/app/channels/application_cable/channel.rb +0 -4
- data/spec/dummy/app/channels/application_cable/connection.rb +0 -4
- data/spec/dummy/app/controllers/application_controller.rb +0 -2
- data/spec/dummy/app/helpers/application_helper.rb +0 -2
- data/spec/dummy/app/jobs/application_job.rb +0 -7
- data/spec/dummy/app/mailers/application_mailer.rb +0 -4
- data/spec/dummy/app/models/application_record.rb +0 -3
- data/spec/dummy/app/views/layouts/application.html.erb +0 -15
- data/spec/dummy/app/views/layouts/mailer.html.erb +0 -13
- data/spec/dummy/app/views/layouts/mailer.text.erb +0 -1
- data/spec/dummy/bin/rails +0 -4
- data/spec/dummy/bin/rake +0 -4
- data/spec/dummy/bin/setup +0 -33
- data/spec/dummy/config/application.rb +0 -53
- data/spec/dummy/config/boot.rb +0 -6
- data/spec/dummy/config/cable.yml +0 -10
- data/spec/dummy/config/credentials.yml.enc +0 -1
- data/spec/dummy/config/database.yml +0 -12
- data/spec/dummy/config/environment.rb +0 -5
- data/spec/dummy/config/environments/development.rb +0 -76
- data/spec/dummy/config/environments/production.rb +0 -120
- data/spec/dummy/config/environments/test.rb +0 -36
- data/spec/dummy/config/initializers/application_controller_renderer.rb +0 -8
- data/spec/dummy/config/initializers/assets.rb +0 -12
- data/spec/dummy/config/initializers/backtrace_silencers.rb +0 -8
- data/spec/dummy/config/initializers/content_security_policy.rb +0 -28
- data/spec/dummy/config/initializers/cookies_serializer.rb +0 -5
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +0 -6
- data/spec/dummy/config/initializers/inflections.rb +0 -16
- data/spec/dummy/config/initializers/mime_types.rb +0 -4
- data/spec/dummy/config/initializers/permissions_policy.rb +0 -11
- data/spec/dummy/config/initializers/spree.rb +0 -74
- data/spec/dummy/config/initializers/wrap_parameters.rb +0 -14
- data/spec/dummy/config/locales/en.yml +0 -33
- data/spec/dummy/config/master.key +0 -1
- data/spec/dummy/config/routes.rb +0 -9
- data/spec/dummy/config/storage.yml +0 -34
- data/spec/dummy/config.ru +0 -6
- data/spec/dummy/db/migrate/20210218213814_create_active_storage_tables.active_storage.rb +0 -36
- data/spec/dummy/db/migrate/20210218213818_create_action_mailbox_tables.action_mailbox.rb +0 -14
- data/spec/dummy/db/migrate/20210218213819_create_action_text_tables.action_text.rb +0 -14
- data/spec/dummy/db/migrate/20210218213820_solidus_one_four.spree.rb +0 -1103
- data/spec/dummy/db/migrate/20210218213821_create_spree_wallet_payment_sources.spree.rb +0 -28
- data/spec/dummy/db/migrate/20210218213822_migrate_credit_cards_to_wallet_payment_sources.spree.rb +0 -30
- data/spec/dummy/db/migrate/20210218213823_remove_is_default_from_prices.spree.rb +0 -8
- data/spec/dummy/db/migrate/20210218213824_remove_currency_from_line_items.spree.rb +0 -8
- data/spec/dummy/db/migrate/20210218213825_add_available_to_columns_and_remove_display_on_from_payment_methods.spree.rb +0 -31
- data/spec/dummy/db/migrate/20210218213826_create_spree_promotion_code_batch.spree.rb +0 -39
- data/spec/dummy/db/migrate/20210218213827_add_available_to_users_and_remove_display_on_from_shipping_methods.spree.rb +0 -23
- data/spec/dummy/db/migrate/20210218213828_add_index_to_spree_payments_number.spree.rb +0 -8
- data/spec/dummy/db/migrate/20210218213829_remove_spree_store_credits_column.spree.rb +0 -8
- data/spec/dummy/db/migrate/20210218213830_add_lft_and_rgt_indexes_to_taxons.spree.rb +0 -9
- data/spec/dummy/db/migrate/20210218213831_remove_order_id_from_inventory_units.spree.rb +0 -31
- data/spec/dummy/db/migrate/20210218213832_transform_tax_rate_category_relation.spree.rb +0 -51
- data/spec/dummy/db/migrate/20210218213833_add_roles_unique_constraints.spree.rb +0 -9
- data/spec/dummy/db/migrate/20210218213834_add_time_range_to_tax_rate.spree.rb +0 -9
- data/spec/dummy/db/migrate/20210218213835_rename_bogus_gateways.spree.rb +0 -19
- data/spec/dummy/db/migrate/20210218213836_remove_default_tax_from_spree_zones.spree.rb +0 -8
- data/spec/dummy/db/migrate/20210218213837_create_promotion_rule_stores.spree.rb +0 -13
- data/spec/dummy/db/migrate/20210218213838_create_store_shipping_methods.spree.rb +0 -13
- data/spec/dummy/db/migrate/20210218213839_add_available_locales_to_stores.spree.rb +0 -10
- data/spec/dummy/db/migrate/20210218213840_add_amount_remaining_to_store_credit_events.spree.rb +0 -62
- data/spec/dummy/db/migrate/20210218213841_add_join_characters_to_promotion_code_batch.spree.rb +0 -12
- data/spec/dummy/db/migrate/20210218213842_add_apply_to_all_to_variant_property_rule.spree.rb +0 -13
- data/spec/dummy/db/migrate/20210218213843_create_spree_store_credit_reasons_table.spree.rb +0 -56
- data/spec/dummy/db/migrate/20210218213844_remove_code_from_spree_promotions.spree.rb +0 -43
- data/spec/dummy/db/migrate/20210218213845_drop_spree_store_credit_update_reasons.spree.rb +0 -20
- data/spec/dummy/db/migrate/20210218213846_add_default_billng_flag_to_user_addresses.spree.rb +0 -7
- data/spec/dummy/db/migrate/20210218213847_add_bcc_email_to_spree_stores.spree.rb +0 -8
- data/spec/dummy/db/migrate/20210218213848_add_discontinue_on_to_spree_products.spree.rb +0 -8
- data/spec/dummy/db/migrate/20210218213849_add_name_to_spree_addresses.spree.rb +0 -14
- data/spec/dummy/db/migrate/20210218213850_add_api_key_to_spree_users.spree_api.rb +0 -10
- data/spec/dummy/db/migrate/20210218213851_resize_api_key_field.spree_api.rb +0 -10
- data/spec/dummy/db/migrate/20210218213852_rename_api_key_to_spree_api_key.spree_api.rb +0 -10
- data/spec/dummy/db/migrate/20210218213853_add_index_to_user_spree_api_key.spree_api.rb +0 -10
- data/spec/dummy/db/schema.rb +0 -1215
- data/spec/dummy/db/seeds.rb +0 -10
- data/spec/dummy/db/solidus_test.sqlite3 +0 -0
- data/spec/dummy/log/test.log +0 -1198
- data/spec/dummy/public/404.html +0 -67
- data/spec/dummy/public/422.html +0 -67
- data/spec/dummy/public/500.html +0 -66
- data/spec/dummy/public/apple-touch-icon-precomposed.png +0 -0
- data/spec/dummy/public/apple-touch-icon.png +0 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/tmp/development_secret.txt +0 -1
- data/spec/dummy/vendor/assets/javascripts/spree/backend/all.js +0 -10
- data/spec/dummy/vendor/assets/javascripts/spree/frontend/all.js +0 -10
- data/spec/dummy/vendor/assets/stylesheets/spree/backend/all.css +0 -9
- data/spec/dummy/vendor/assets/stylesheets/spree/frontend/all.css +0 -9
- data/spec/examples.txt +0 -4
- data/spec/solidus_i18n_spec.rb +0 -67
- data/spec/spec_helper.rb +0 -33
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
# This migration comes from spree (originally 20160420044191)
|
|
3
|
-
|
|
4
|
-
class CreateSpreeWalletPaymentSources < ActiveRecord::Migration[4.2]
|
|
5
|
-
def change
|
|
6
|
-
return if table_exists?(:spree_wallet_payment_sources)
|
|
7
|
-
|
|
8
|
-
create_table :spree_wallet_payment_sources do |t|
|
|
9
|
-
t.references(
|
|
10
|
-
:user,
|
|
11
|
-
foreign_key: { to_table: Spree.user_class.table_name },
|
|
12
|
-
index: true,
|
|
13
|
-
null: false,
|
|
14
|
-
)
|
|
15
|
-
t.references :payment_source, polymorphic: true, null: false
|
|
16
|
-
t.boolean :default, default: false, null: false
|
|
17
|
-
|
|
18
|
-
t.timestamps null: false, precision: 6
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
add_index(
|
|
22
|
-
:spree_wallet_payment_sources,
|
|
23
|
-
[:user_id, :payment_source_id, :payment_source_type],
|
|
24
|
-
unique: true,
|
|
25
|
-
name: 'index_spree_wallet_payment_sources_on_source_and_user',
|
|
26
|
-
)
|
|
27
|
-
end
|
|
28
|
-
end
|
data/spec/dummy/db/migrate/20210218213822_migrate_credit_cards_to_wallet_payment_sources.spree.rb
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
# This migration comes from spree (originally 20160420181916)
|
|
3
|
-
|
|
4
|
-
class MigrateCreditCardsToWalletPaymentSources < ActiveRecord::Migration[4.2]
|
|
5
|
-
class CreditCard < ActiveRecord::Base
|
|
6
|
-
self.table_name = 'spree_credit_cards'
|
|
7
|
-
end
|
|
8
|
-
class WalletPaymentSource < ActiveRecord::Base
|
|
9
|
-
self.table_name = 'spree_wallet_payment_sources'
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
def up
|
|
13
|
-
credit_cards = CreditCard.
|
|
14
|
-
where.not(gateway_customer_profile_id: nil).
|
|
15
|
-
where.not(user_id: nil)
|
|
16
|
-
|
|
17
|
-
credit_cards.find_each do |credit_card|
|
|
18
|
-
WalletPaymentSource.find_or_create_by!(
|
|
19
|
-
user_id: credit_card.user_id,
|
|
20
|
-
payment_source_id: credit_card.id,
|
|
21
|
-
payment_source_type: 'Spree::CreditCard'
|
|
22
|
-
) do |wallet_source|
|
|
23
|
-
wallet_source.default = credit_card.default
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
def down
|
|
29
|
-
end
|
|
30
|
-
end
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
# This migration comes from spree (originally 20161014221052)
|
|
3
|
-
|
|
4
|
-
class AddAvailableToColumnsAndRemoveDisplayOnFromPaymentMethods < ActiveRecord::Migration[5.0]
|
|
5
|
-
def up
|
|
6
|
-
add_column(:spree_payment_methods, :available_to_users, :boolean, default: true)
|
|
7
|
-
add_column(:spree_payment_methods, :available_to_admin, :boolean, default: true)
|
|
8
|
-
execute("UPDATE spree_payment_methods "\
|
|
9
|
-
"SET available_to_users=#{quoted_false} "\
|
|
10
|
-
"WHERE NOT (display_on='front_end' OR display_on='' OR display_on IS NULL)")
|
|
11
|
-
execute("UPDATE spree_payment_methods "\
|
|
12
|
-
"SET available_to_admin=#{quoted_false} "\
|
|
13
|
-
"WHERE NOT (display_on='back_end' OR display_on='' OR display_on IS NULL)")
|
|
14
|
-
remove_column(:spree_payment_methods, :display_on)
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
def down
|
|
18
|
-
add_column(:spree_payment_methods, :display_on, :string)
|
|
19
|
-
execute("UPDATE spree_payment_methods "\
|
|
20
|
-
"SET display_on='' "\
|
|
21
|
-
"WHERE (available_to_users=#{quoted_true} AND available_to_admin=#{quoted_true})")
|
|
22
|
-
execute("UPDATE spree_payment_methods "\
|
|
23
|
-
"SET display_on='front_end' "\
|
|
24
|
-
"WHERE (available_to_users=#{quoted_true} AND NOT available_to_admin=#{quoted_true})")
|
|
25
|
-
execute("UPDATE spree_payment_methods "\
|
|
26
|
-
"SET display_on='back_end' "\
|
|
27
|
-
"WHERE (available_to_admin=#{quoted_true} AND NOT available_to_users=#{quoted_true})")
|
|
28
|
-
remove_column(:spree_payment_methods, :available_to_users)
|
|
29
|
-
remove_column(:spree_payment_methods, :available_to_admin)
|
|
30
|
-
end
|
|
31
|
-
end
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
# This migration comes from spree (originally 20161017102621)
|
|
3
|
-
|
|
4
|
-
class CreateSpreePromotionCodeBatch < ActiveRecord::Migration[5.0]
|
|
5
|
-
def change
|
|
6
|
-
create_table :spree_promotion_code_batches do |t|
|
|
7
|
-
t.references :promotion, null: false, index: true
|
|
8
|
-
t.string :base_code, null: false
|
|
9
|
-
t.integer :number_of_codes, null: false
|
|
10
|
-
t.string :email
|
|
11
|
-
t.string :error
|
|
12
|
-
t.string :state, default: "pending"
|
|
13
|
-
t.timestamps precision: 6
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
add_foreign_key(
|
|
17
|
-
:spree_promotion_code_batches,
|
|
18
|
-
:spree_promotions,
|
|
19
|
-
column: :promotion_id
|
|
20
|
-
)
|
|
21
|
-
|
|
22
|
-
add_column(
|
|
23
|
-
:spree_promotion_codes,
|
|
24
|
-
:promotion_code_batch_id,
|
|
25
|
-
:integer
|
|
26
|
-
)
|
|
27
|
-
|
|
28
|
-
add_foreign_key(
|
|
29
|
-
:spree_promotion_codes,
|
|
30
|
-
:spree_promotion_code_batches,
|
|
31
|
-
column: :promotion_code_batch_id
|
|
32
|
-
)
|
|
33
|
-
|
|
34
|
-
add_index(
|
|
35
|
-
:spree_promotion_codes,
|
|
36
|
-
:promotion_code_batch_id
|
|
37
|
-
)
|
|
38
|
-
end
|
|
39
|
-
end
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
# This migration comes from spree (originally 20161123154034)
|
|
3
|
-
|
|
4
|
-
class AddAvailableToUsersAndRemoveDisplayOnFromShippingMethods < ActiveRecord::Migration[5.0]
|
|
5
|
-
def up
|
|
6
|
-
add_column(:spree_shipping_methods, :available_to_users, :boolean, default: true)
|
|
7
|
-
execute("UPDATE spree_shipping_methods "\
|
|
8
|
-
"SET available_to_users=#{quoted_false} "\
|
|
9
|
-
"WHERE display_on='back_end'")
|
|
10
|
-
remove_column(:spree_shipping_methods, :display_on)
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
def down
|
|
14
|
-
add_column(:spree_shipping_methods, :display_on, :string)
|
|
15
|
-
execute("UPDATE spree_shipping_methods "\
|
|
16
|
-
"SET display_on='both' "\
|
|
17
|
-
"WHERE (available_to_users=#{quoted_true})")
|
|
18
|
-
execute("UPDATE spree_shipping_methods "\
|
|
19
|
-
"SET display_on='back_end' "\
|
|
20
|
-
"WHERE (available_to_users=#{quoted_false})")
|
|
21
|
-
remove_column(:spree_shipping_methods, :available_to_users)
|
|
22
|
-
end
|
|
23
|
-
end
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
# This migration comes from spree (originally 20170319191942)
|
|
3
|
-
|
|
4
|
-
class RemoveOrderIdFromInventoryUnits < ActiveRecord::Migration[5.0]
|
|
5
|
-
class InconsistentInventoryUnitError < StandardError; end
|
|
6
|
-
|
|
7
|
-
class InventoryUnit < ActiveRecord::Base
|
|
8
|
-
self.table_name = "spree_inventory_units"
|
|
9
|
-
belongs_to :shipment
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
class Shipment < ActiveRecord::Base
|
|
13
|
-
self.table_name = "spree_shipments"
|
|
14
|
-
has_many :inventory_units
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
def up
|
|
18
|
-
if InventoryUnit.
|
|
19
|
-
joins(:shipment).
|
|
20
|
-
where.not(
|
|
21
|
-
'spree_inventory_units.order_id = spree_shipments.order_id'
|
|
22
|
-
).exists?
|
|
23
|
-
raise InconsistentInventoryUnitError, "You have inventory units with inconsistent order references. Please fix those before running this migration"
|
|
24
|
-
end
|
|
25
|
-
remove_column :spree_inventory_units, :order_id
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
def down
|
|
29
|
-
add_reference :spree_inventory_units, :order, index: true
|
|
30
|
-
end
|
|
31
|
-
end
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
# This migration comes from spree (originally 20170412103617)
|
|
3
|
-
|
|
4
|
-
class TransformTaxRateCategoryRelation < ActiveRecord::Migration[5.0]
|
|
5
|
-
class TaxRate < ActiveRecord::Base
|
|
6
|
-
self.table_name = "spree_tax_rates"
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
class TaxRateTaxCategory < ActiveRecord::Base
|
|
10
|
-
self.table_name = "spree_tax_rate_tax_categories"
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
def up
|
|
14
|
-
create_table :spree_tax_rate_tax_categories do |t|
|
|
15
|
-
t.integer :tax_category_id, index: true, null: false
|
|
16
|
-
t.integer :tax_rate_id, index: true, null: false
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
add_foreign_key :spree_tax_rate_tax_categories, :spree_tax_categories, column: :tax_category_id
|
|
20
|
-
add_foreign_key :spree_tax_rate_tax_categories, :spree_tax_rates, column: :tax_rate_id
|
|
21
|
-
|
|
22
|
-
TaxRate.where.not(tax_category_id: nil).find_each do |tax_rate|
|
|
23
|
-
TaxRateTaxCategory.create!(
|
|
24
|
-
tax_rate_id: tax_rate.id,
|
|
25
|
-
tax_category_id: tax_rate.tax_category_id
|
|
26
|
-
)
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
remove_column :spree_tax_rates, :tax_category_id
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
def down
|
|
33
|
-
add_column :spree_tax_rates, :tax_category_id, :integer, index: true
|
|
34
|
-
add_foreign_key :spree_tax_rates, :spree_tax_categories, column: :tax_category_id
|
|
35
|
-
|
|
36
|
-
TaxRate.find_each do |tax_rate|
|
|
37
|
-
tax_category_ids = TaxRateTaxCategory.where(tax_rate_id: tax_rate.id).pluck(:tax_category_id)
|
|
38
|
-
|
|
39
|
-
tax_category_ids.each_with_index do |category_id, i|
|
|
40
|
-
if i.zero?
|
|
41
|
-
tax_rate.update!(tax_category_id: category_id)
|
|
42
|
-
else
|
|
43
|
-
new_tax_rate = tax_rate.dup
|
|
44
|
-
new_tax_rate.update!(tax_category_id: category_id)
|
|
45
|
-
end
|
|
46
|
-
end
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
drop_table :spree_tax_rate_tax_categories
|
|
50
|
-
end
|
|
51
|
-
end
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
# This migration comes from spree (originally 20170422134804)
|
|
3
|
-
|
|
4
|
-
class AddRolesUniqueConstraints < ActiveRecord::Migration[5.0]
|
|
5
|
-
def change
|
|
6
|
-
add_index :spree_roles, :name, unique: true
|
|
7
|
-
add_index :spree_roles_users, [:user_id, :role_id], unique: true
|
|
8
|
-
end
|
|
9
|
-
end
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
# This migration comes from spree (originally 20170522143442)
|
|
3
|
-
|
|
4
|
-
class AddTimeRangeToTaxRate < ActiveRecord::Migration[5.0]
|
|
5
|
-
def change
|
|
6
|
-
add_column :spree_tax_rates, :starts_at, :datetime
|
|
7
|
-
add_column :spree_tax_rates, :expires_at, :datetime
|
|
8
|
-
end
|
|
9
|
-
end
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
# This migration comes from spree (originally 20170608074534)
|
|
3
|
-
|
|
4
|
-
class RenameBogusGateways < ActiveRecord::Migration[5.0]
|
|
5
|
-
# This migration was only performing a data migration useful updating to
|
|
6
|
-
# Solidus v2.3.
|
|
7
|
-
# Once the update is done, this is no more required to run so we can clean
|
|
8
|
-
# this file to just be a noop.
|
|
9
|
-
# For more info on the original content see:
|
|
10
|
-
# https://github.com/solidusio/solidus/pull/2001
|
|
11
|
-
|
|
12
|
-
def up
|
|
13
|
-
# no-op
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
def down
|
|
17
|
-
# no-op
|
|
18
|
-
end
|
|
19
|
-
end
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
# This migration comes from spree (originally 20180202190713)
|
|
3
|
-
|
|
4
|
-
class CreatePromotionRuleStores < ActiveRecord::Migration[5.1]
|
|
5
|
-
def change
|
|
6
|
-
create_table :spree_promotion_rules_stores do |t|
|
|
7
|
-
t.references :store, null: false
|
|
8
|
-
t.references :promotion_rule, null: false
|
|
9
|
-
|
|
10
|
-
t.timestamps
|
|
11
|
-
end
|
|
12
|
-
end
|
|
13
|
-
end
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
# This migration comes from spree (originally 20180202222641)
|
|
3
|
-
|
|
4
|
-
class CreateStoreShippingMethods < ActiveRecord::Migration[5.1]
|
|
5
|
-
def change
|
|
6
|
-
create_table :spree_store_shipping_methods do |t|
|
|
7
|
-
t.references :store, null: false
|
|
8
|
-
t.references :shipping_method, null: false
|
|
9
|
-
|
|
10
|
-
t.timestamps precision: 6
|
|
11
|
-
end
|
|
12
|
-
end
|
|
13
|
-
end
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
# This migration comes from spree (originally 20180313220213)
|
|
3
|
-
|
|
4
|
-
class AddAvailableLocalesToStores < ActiveRecord::Migration[5.1]
|
|
5
|
-
def change
|
|
6
|
-
change_table :spree_stores do |t|
|
|
7
|
-
t.column :available_locales, :string
|
|
8
|
-
end
|
|
9
|
-
end
|
|
10
|
-
end
|
data/spec/dummy/db/migrate/20210218213840_add_amount_remaining_to_store_credit_events.spree.rb
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
# This migration comes from spree (originally 20180322142651)
|
|
3
|
-
|
|
4
|
-
class AddAmountRemainingToStoreCreditEvents < ActiveRecord::Migration[5.0]
|
|
5
|
-
class StoreCredit < ActiveRecord::Base
|
|
6
|
-
self.table_name = 'spree_store_credits'
|
|
7
|
-
has_many :store_credit_events
|
|
8
|
-
|
|
9
|
-
VOID_ACTION = 'void'
|
|
10
|
-
CREDIT_ACTION = 'credit'
|
|
11
|
-
CAPTURE_ACTION = 'capture'
|
|
12
|
-
ELIGIBLE_ACTION = 'eligible'
|
|
13
|
-
AUTHORIZE_ACTION = 'authorize'
|
|
14
|
-
ALLOCATION_ACTION = 'allocation'
|
|
15
|
-
ADJUSTMENT_ACTION = 'adjustment'
|
|
16
|
-
INVALIDATE_ACTION = 'invalidate'
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
class StoreCreditEvent < ActiveRecord::Base
|
|
20
|
-
self.table_name = "spree_store_credit_events"
|
|
21
|
-
belongs_to :store_credit
|
|
22
|
-
|
|
23
|
-
scope :chronological, -> { order(:created_at) }
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
def up
|
|
27
|
-
add_column :spree_store_credit_events, :amount_remaining, :decimal, precision: 8, scale: 2, default: nil, null: true
|
|
28
|
-
|
|
29
|
-
StoreCredit.includes(:store_credit_events).find_each do |credit|
|
|
30
|
-
credit_amount = credit.amount
|
|
31
|
-
|
|
32
|
-
credit.store_credit_events.chronological.each do |event|
|
|
33
|
-
case event.action
|
|
34
|
-
when StoreCredit::ALLOCATION_ACTION,
|
|
35
|
-
StoreCredit::ELIGIBLE_ACTION,
|
|
36
|
-
StoreCredit::CAPTURE_ACTION
|
|
37
|
-
# These actions do not change the amount_remaining so the previous
|
|
38
|
-
# amount available is used (either the credit's amount or the
|
|
39
|
-
# amount_remaining coming from the event right before this one).
|
|
40
|
-
credit_amount
|
|
41
|
-
when StoreCredit::AUTHORIZE_ACTION,
|
|
42
|
-
StoreCredit::INVALIDATE_ACTION
|
|
43
|
-
# These actions remove the amount from the available credit amount.
|
|
44
|
-
credit_amount -= event.amount
|
|
45
|
-
when StoreCredit::ADJUSTMENT_ACTION,
|
|
46
|
-
StoreCredit::CREDIT_ACTION,
|
|
47
|
-
StoreCredit::VOID_ACTION
|
|
48
|
-
# These actions add the amount to the available credit amount. For
|
|
49
|
-
# ADJUSTMENT_ACTION the event's amount could be negative (so it could
|
|
50
|
-
# end up subtracting the amount).
|
|
51
|
-
credit_amount += event.amount
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
event.update_attribute(:amount_remaining, credit_amount)
|
|
55
|
-
end
|
|
56
|
-
end
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
def down
|
|
60
|
-
remove_column :spree_store_credit_events, :amount_remaining
|
|
61
|
-
end
|
|
62
|
-
end
|
data/spec/dummy/db/migrate/20210218213841_add_join_characters_to_promotion_code_batch.spree.rb
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
# This migration comes from spree (originally 20180328172631)
|
|
3
|
-
|
|
4
|
-
class AddJoinCharactersToPromotionCodeBatch < ActiveRecord::Migration[5.1]
|
|
5
|
-
def change
|
|
6
|
-
add_column(:spree_promotion_code_batches,
|
|
7
|
-
:join_characters,
|
|
8
|
-
:string,
|
|
9
|
-
null: false,
|
|
10
|
-
default: '_')
|
|
11
|
-
end
|
|
12
|
-
end
|
data/spec/dummy/db/migrate/20210218213842_add_apply_to_all_to_variant_property_rule.spree.rb
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
# This migration comes from spree (originally 20180416083007)
|
|
3
|
-
|
|
4
|
-
class AddApplyToAllToVariantPropertyRule < ActiveRecord::Migration[5.1]
|
|
5
|
-
def change
|
|
6
|
-
add_column :spree_variant_property_rules, :apply_to_all, :boolean, default: false, null: false
|
|
7
|
-
change_column :spree_variant_property_rules, :apply_to_all, :boolean, default: true
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
def down
|
|
11
|
-
remove_column :spree_variant_property_rules, :apply_to_all
|
|
12
|
-
end
|
|
13
|
-
end
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
# This migration comes from spree (originally 20180710170104)
|
|
3
|
-
|
|
4
|
-
class CreateSpreeStoreCreditReasonsTable < ActiveRecord::Migration[5.1]
|
|
5
|
-
class StoreCreditUpdateReason < ActiveRecord::Base
|
|
6
|
-
self.table_name = "spree_store_credit_update_reasons"
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
class StoreCreditReason < ActiveRecord::Base
|
|
10
|
-
self.table_name = "spree_store_credit_reasons"
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
def up
|
|
14
|
-
create_table :spree_store_credit_reasons do |t|
|
|
15
|
-
t.string :name
|
|
16
|
-
t.boolean :active, default: true
|
|
17
|
-
|
|
18
|
-
t.timestamps
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
StoreCreditUpdateReason.all.each do |update_reason|
|
|
22
|
-
StoreCreditReason.create!(name: update_reason.name)
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
add_column :spree_store_credit_events, :store_credit_reason_id, :integer
|
|
26
|
-
execute "update spree_store_credit_events set store_credit_reason_id = update_reason_id"
|
|
27
|
-
|
|
28
|
-
# TODO: table spree_store_credit_update_reasons and column
|
|
29
|
-
# column spree_store_credit_update_reasons.update_reason_id
|
|
30
|
-
# must be dropped in a future Solidus release
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
def down
|
|
34
|
-
# This table and column may not exist anymore as another irreversible
|
|
35
|
-
# migration may have removed it later. They must be added back or the
|
|
36
|
-
# `up` method would fail
|
|
37
|
-
unless table_exists? :spree_store_credit_update_reasons
|
|
38
|
-
create_table :spree_store_credit_update_reasons do |t|
|
|
39
|
-
t.string :name
|
|
40
|
-
|
|
41
|
-
t.timestamps
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
unless column_exists? :spree_store_credit_events, :update_reason_id
|
|
45
|
-
add_column :spree_store_credit_events, :update_reason_id, :integer
|
|
46
|
-
end
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
StoreCreditReason.all.each do |store_credit_reason|
|
|
50
|
-
StoreCreditUpdateReason.create!(name: store_credit_reason.name)
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
drop_table :spree_store_credit_reasons
|
|
54
|
-
remove_column :spree_store_credit_events, :store_credit_reason_id
|
|
55
|
-
end
|
|
56
|
-
end
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
# This migration comes from spree (originally 20190106184413)
|
|
3
|
-
|
|
4
|
-
require 'solidus/migrations/promotions_with_code_handlers'
|
|
5
|
-
|
|
6
|
-
class RemoveCodeFromSpreePromotions < ActiveRecord::Migration[5.1]
|
|
7
|
-
class Promotion < ActiveRecord::Base
|
|
8
|
-
self.table_name = "spree_promotions"
|
|
9
|
-
self.ignored_columns = %w(type)
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
def up
|
|
13
|
-
promotions_with_code = Promotion.where.not(code: [nil, ''])
|
|
14
|
-
|
|
15
|
-
if promotions_with_code.any?
|
|
16
|
-
# You have some promotions with "code" field present! This is not good
|
|
17
|
-
# since we are going to remove that column.
|
|
18
|
-
#
|
|
19
|
-
self.class.promotions_with_code_handler.new(self, promotions_with_code).call
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
remove_index :spree_promotions, name: :index_spree_promotions_on_code
|
|
23
|
-
remove_column :spree_promotions, :code
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
def down
|
|
27
|
-
add_column :spree_promotions, :code, :string
|
|
28
|
-
add_index :spree_promotions, :code, name: :index_spree_promotions_on_code
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
def self.promotions_with_code_handler
|
|
32
|
-
# We propose different approaches, just pick the one that you prefer or
|
|
33
|
-
# write your custom one.
|
|
34
|
-
#
|
|
35
|
-
# The fist one (raising an exception) is the default but you can
|
|
36
|
-
# comment/uncomment the one then better fits you needs or use a
|
|
37
|
-
# custom class or callable object.
|
|
38
|
-
#
|
|
39
|
-
Solidus::Migrations::PromotionWithCodeHandlers::RaiseException
|
|
40
|
-
# Solidus::Migrations::PromotionWithCodeHandlers::MoveToSpreePromotionCode
|
|
41
|
-
# Solidus::Migrations::PromotionWithCodeHandlers::DoNothing
|
|
42
|
-
end
|
|
43
|
-
end
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
# This migration comes from spree (originally 20190220093635)
|
|
3
|
-
|
|
4
|
-
class DropSpreeStoreCreditUpdateReasons < ActiveRecord::Migration[5.1]
|
|
5
|
-
# This migration should run in a subsequent deploy after 20180710170104
|
|
6
|
-
# has been already deployed. See also migration 20180710170104.
|
|
7
|
-
|
|
8
|
-
# We can't add back the table in a `down` method here: a previous version
|
|
9
|
-
# of migration 20180710170104 would fail with `table already exists` , as
|
|
10
|
-
# it handles itself the add/remove of this table and column.
|
|
11
|
-
def up
|
|
12
|
-
if table_exists? :spree_store_credit_update_reasons
|
|
13
|
-
drop_table :spree_store_credit_update_reasons
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
if column_exists? :spree_store_credit_events, :update_reason_id
|
|
17
|
-
remove_column :spree_store_credit_events, :update_reason_id
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
end
|
data/spec/dummy/db/migrate/20210218213846_add_default_billng_flag_to_user_addresses.spree.rb
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
# This migration comes from spree (originally 20200320144521)
|
|
3
|
-
class AddDefaultBillngFlagToUserAddresses < ActiveRecord::Migration[5.2]
|
|
4
|
-
def change
|
|
5
|
-
add_column :spree_user_addresses, :default_billing, :boolean, default: false
|
|
6
|
-
end
|
|
7
|
-
end
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
# This migration comes from spree (originally 20210122110141)
|
|
3
|
-
|
|
4
|
-
class AddNameToSpreeAddresses < ActiveRecord::Migration[5.2]
|
|
5
|
-
def up
|
|
6
|
-
add_column :spree_addresses, :name, :string
|
|
7
|
-
add_index :spree_addresses, :name
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
def down
|
|
11
|
-
remove_index :spree_addresses, :name
|
|
12
|
-
remove_column :spree_addresses, :name
|
|
13
|
-
end
|
|
14
|
-
end
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
# This migration comes from spree_api (originally 20100107141738)
|
|
3
|
-
|
|
4
|
-
class AddApiKeyToSpreeUsers < ActiveRecord::Migration[4.2]
|
|
5
|
-
def change
|
|
6
|
-
unless defined?(User)
|
|
7
|
-
add_column :spree_users, :api_key, :string, limit: 40
|
|
8
|
-
end
|
|
9
|
-
end
|
|
10
|
-
end
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
# This migration comes from spree_api (originally 20120411123334)
|
|
3
|
-
|
|
4
|
-
class ResizeApiKeyField < ActiveRecord::Migration[4.2]
|
|
5
|
-
def up
|
|
6
|
-
unless defined?(User)
|
|
7
|
-
change_column :spree_users, :api_key, :string, limit: 48
|
|
8
|
-
end
|
|
9
|
-
end
|
|
10
|
-
end
|