Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.
Ruby b2b-commercee-commerceecommerceecommerce-apiecommerce-frameworkecommerce-platformheadlessheadless-commerceheadless-ecommercemarketplacemulti-tenantmulti-vendormulti-vendor-ecommerceopen-sourcespree-commerce
* refactor new migration * update sandbox installer
Łukasz Adamczyka8542efbe3bf
diff --git a/bin/sandbox.sh b/bin/sandbox.shindex a4f6915fbb..cd4d6081cc 100755--- a/bin/sandbox.sh+++ b/bin/sandbox.sh@@ -79,7 +79,6 @@ $SPREE_GATEWAY_GEMgem 'spree_i18n', github: 'spree-contrib/spree_i18n', branch: 'master'gem 'spree_static_content', github: 'spree-contrib/spree_static_content', branch: 'master'gem 'spree_related_products', github: 'spree-contrib/spree_related_products', branch: 'master'-gem 'spree_multi_domain', github: 'spree-contrib/spree-multi-domain', branch: 'master'group :test, :development dogem 'bullet'@@ -114,5 +113,4 @@ bundle exec rails g spree_gateway:installif [ "$SPREE_HEADLESS" == "" ]; thenbundle exec rails g spree_related_products:installbundle exec rails g spree_static_content:install- bundle exec rails g spree_multi_domain:installfidiff --git a/core/db/migrate/20210527094055_create_spree_products_stores.rb b/core/db/migrate/20210527094055_create_spree_products_stores.rbindex d1d98468b6..e9557711b1 100644--- a/core/db/migrate/20210527094055_create_spree_products_stores.rb+++ b/core/db/migrate/20210527094055_create_spree_products_stores.rb@@ -1,12 +1,12 @@class CreateSpreeProductsStores < ActiveRecord::Migration[5.2]- def change- create_table :spree_products_stores, id: :serial do |t|+ def up+ create_table :spree_products_stores, id: :serial, if_not_exists: true do |t|t.references :product, index: truet.references :store, index: truet.timestamps- end- add_index :spree_products_stores, [:product_id, :store_id], unique: true+ t.index [:product_id, :store_id], unique: true+ endstores = Spree::Store.allproduct_ids = Spree::Product.with_deleted.order(:id).ids@@ -15,7 +15,13 @@ class CreateSpreeProductsStores < ActiveRecord::Migration[5.2]prepared_values = product_ids.map { |id| "(#{id}, #{store.id}, '#{Time.current.to_s(:db)}', '#{Time.current.to_s(:db)}')" }.join(', ')next if prepared_values.empty?- execute "INSERT INTO spree_products_stores (product_id, store_id, created_at, updated_at) VALUES #{prepared_values};"+ begin+ execute "INSERT INTO spree_products_stores (product_id, store_id, created_at, updated_at) VALUES #{prepared_values};"+ rescue ActiveRecord::RecordNotUnique; endendend++ def down+ drop_table :spree_products_stores+ endend