Skip to content

armgit / spree

Public Imported from GitHub
0

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.

Fix server app schema, preserve migrations (#13786)

Damian Legawiec754031741c38
diff --git a/.gitignore b/.gitignore
index 68bb15beeb..d0b0a14921 100644
--- a/.gitignore
+++ b/.gitignore
@@ -48,7 +48,6 @@ test_app
.ruby-gemset
**/.bundle
**/vendor/bundle
-server/db/migrate
.ignore
TODO
brakeman-*.*
diff --git a/server/db/migrate/20260317145632_devise_create_spree_users.rb b/server/db/migrate/20260317145632_devise_create_spree_users.rb
new file mode 100644
index 0000000000..0d0178da33
--- /dev/null
+++ b/server/db/migrate/20260317145632_devise_create_spree_users.rb
@@ -0,0 +1,44 @@
+# frozen_string_literal: true
+
+class DeviseCreateSpreeUsers < ActiveRecord::Migration[7.2]
+ def change
+ create_table :spree_users do |t|
+ ## Database authenticatable
+ t.string :email, null: false, default: ""
+ t.string :encrypted_password, null: false, default: ""
+
+ ## Recoverable
+ t.string :reset_password_token
+ t.datetime :reset_password_sent_at
+
+ ## Rememberable
+ t.datetime :remember_created_at
+
+ ## Trackable
+ t.integer :sign_in_count, default: 0, null: false
+ t.datetime :current_sign_in_at
+ t.datetime :last_sign_in_at
+ t.string :current_sign_in_ip
+ t.string :last_sign_in_ip
+
+ ## Confirmable
+ t.string :confirmation_token
+ t.datetime :confirmed_at
+ t.datetime :confirmation_sent_at
+ t.string :unconfirmed_email # Only if using reconfirmable
+
+ ## Lockable
+ t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts
+ t.string :unlock_token # Only if unlock strategy is :email or :both
+ t.datetime :locked_at
+
+
+ t.timestamps null: false
+ end
+
+ add_index :spree_users, :email, unique: true
+ add_index :spree_users, :reset_password_token, unique: true
+ add_index :spree_users, :confirmation_token, unique: true
+ add_index :spree_users, :unlock_token, unique: true
+ end
+end
diff --git a/server/db/migrate/20260317145640_devise_create_spree_admin_users.rb b/server/db/migrate/20260317145640_devise_create_spree_admin_users.rb
new file mode 100644
index 0000000000..7c2e62ff96
--- /dev/null
+++ b/server/db/migrate/20260317145640_devise_create_spree_admin_users.rb
@@ -0,0 +1,44 @@
+# frozen_string_literal: true
+
+class DeviseCreateSpreeAdminUsers < ActiveRecord::Migration[7.2]
+ def change
+ create_table :spree_admin_users do |t|
+ ## Database authenticatable
+ t.string :email, null: false, default: ""
+ t.string :encrypted_password, null: false, default: ""
+
+ ## Recoverable
+ t.string :reset_password_token
+ t.datetime :reset_password_sent_at
+
+ ## Rememberable
+ t.datetime :remember_created_at
+
+ ## Trackable
+ t.integer :sign_in_count, default: 0, null: false
+ t.datetime :current_sign_in_at
+ t.datetime :last_sign_in_at
+ t.string :current_sign_in_ip
+ t.string :last_sign_in_ip
+
+ ## Confirmable
+ t.string :confirmation_token
+ t.datetime :confirmed_at
+ t.datetime :confirmation_sent_at
+ t.string :unconfirmed_email # Only if using reconfirmable
+
+ ## Lockable
+ t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts
+ t.string :unlock_token # Only if unlock strategy is :email or :both
+ t.datetime :locked_at
+
+
+ t.timestamps null: false
+ end
+
+ add_index :spree_admin_users, :email, unique: true
+ add_index :spree_admin_users, :reset_password_token, unique: true
+ add_index :spree_admin_users, :confirmation_token, unique: true
+ add_index :spree_admin_users, :unlock_token, unique: true
+ end
+end
diff --git a/server/db/migrate/20260317145933_create_active_storage_tables.active_storage.rb b/server/db/migrate/20260317145933_create_active_storage_tables.active_storage.rb
new file mode 100644
index 0000000000..6bd8bd082a
--- /dev/null
+++ b/server/db/migrate/20260317145933_create_active_storage_tables.active_storage.rb
@@ -0,0 +1,57 @@
+# This migration comes from active_storage (originally 20170806125915)
+class CreateActiveStorageTables < ActiveRecord::Migration[7.0]
+ def change
+ # Use Active Record's configured type for primary and foreign keys
+ primary_key_type, foreign_key_type = primary_and_foreign_key_types
+
+ create_table :active_storage_blobs, id: primary_key_type do |t|
+ t.string :key, null: false
+ t.string :filename, null: false
+ t.string :content_type
+ t.text :metadata
+ t.string :service_name, null: false
+ t.bigint :byte_size, null: false
+ t.string :checksum
+
+ if connection.supports_datetime_with_precision?
+ t.datetime :created_at, precision: 6, null: false
+ else
+ t.datetime :created_at, null: false
+ end
+
+ t.index [ :key ], unique: true
+ end
+
+ create_table :active_storage_attachments, id: primary_key_type do |t|
+ t.string :name, null: false
+ t.references :record, null: false, polymorphic: true, index: false, type: foreign_key_type
+ t.references :blob, null: false, type: foreign_key_type
+
+ if connection.supports_datetime_with_precision?
+ t.datetime :created_at, precision: 6, null: false
+ else
+ t.datetime :created_at, null: false
+ end
+
+ t.index [ :record_type, :record_id, :name, :blob_id ], name: :index_active_storage_attachments_uniqueness, unique: true
+ t.foreign_key :active_storage_blobs, column: :blob_id
+ end
+
+ create_table :active_storage_variant_records, id: primary_key_type do |t|
+ t.belongs_to :blob, null: false, index: false, type: foreign_key_type
+ t.string :variation_digest, null: false
+
+ t.index [ :blob_id, :variation_digest ], name: :index_active_storage_variant_records_uniqueness, unique: true
+ t.foreign_key :active_storage_blobs, column: :blob_id
+ end
+ end
+
+ private
+ def primary_and_foreign_key_types
+ config = Rails.configuration.generators
+ setting = config.options[config.orm][:primary_key_type]
+ primary_key_type = setting || :primary_key
+ foreign_key_type = setting || :bigint
+ [ primary_key_type, foreign_key_type ]
+ end
+end
diff --git a/server/db/migrate/20260317145942_create_action_text_tables.action_text.rb b/server/db/migrate/20260317145942_create_action_text_tables.action_text.rb
new file mode 100644
index 0000000000..c1c0a9d8cc
--- /dev/null
+++ b/server/db/migrate/20260317145942_create_action_text_tables.action_text.rb
@@ -0,0 +1,26 @@
+# This migration comes from action_text (originally 20180528164100)
+class CreateActionTextTables < ActiveRecord::Migration[6.0]
+ def change
+ # Use Active Record's configured type for primary and foreign keys
+ primary_key_type, foreign_key_type = primary_and_foreign_key_types
+
+ create_table :action_text_rich_texts, id: primary_key_type do |t|
+ t.string :name, null: false
+ t.text :body, size: :long
+ t.references :record, null: false, polymorphic: true, index: false, type: foreign_key_type
+
+ t.timestamps
+
+ t.index [ :record_type, :record_id, :name ], name: "index_action_text_rich_texts_uniqueness", unique: true
+ end
+ end
+
+ private
+ def primary_and_foreign_key_types
+ config = Rails.configuration.generators
+ setting = config.options[config.orm][:primary_key_type]
+ primary_key_type = setting || :primary_key
+ foreign_key_type = setting || :bigint
+ [ primary_key_type, foreign_key_type ]
+ end
+end
diff --git a/server/db/migrate/20260317145959_spree_four_three.spree.rb b/server/db/migrate/20260317145959_spree_four_three.spree.rb
new file mode 100644
index 0000000000..b71a7910a4
--- /dev/null
+++ b/server/db/migrate/20260317145959_spree_four_three.spree.rb
@@ -0,0 +1,1089 @@
+# This migration comes from spree (originally 20210914000000)
+class SpreeFourThree < ActiveRecord::Migration[5.2]
+ def up
+ # This migration is just a compressed version of all the previous
+ # migrations for spree_core. Do not run it if one of the core tables
+ # already exists. Assume the best.
+ return if data_source_exists?(:spree_addresses)
+
+ create_table "friendly_id_slugs", force: :cascade do |t|
+ t.string "slug", null: false
+ t.bigint "sluggable_id", null: false
+ t.string "sluggable_type", limit: 50
+ t.string "scope"
+ t.datetime "created_at"
+ t.datetime "deleted_at"
+ t.index ["deleted_at"], name: "index_friendly_id_slugs_on_deleted_at"
+ t.index ["slug", "sluggable_type", "scope"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type_and_scope", unique: true
+ t.index ["slug", "sluggable_type"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type"
+ t.index ["sluggable_id"], name: "index_friendly_id_slugs_on_sluggable_id"
+ t.index ["sluggable_type"], name: "index_friendly_id_slugs_on_sluggable_type"
+ end
+
+ create_table "spree_addresses", force: :cascade do |t|
+ t.string "firstname"
+ t.string "lastname"
+ t.string "address1"
+ t.string "address2"
+ t.string "city"
+ t.string "zipcode"
+ t.string "phone"
+ t.string "state_name"
+ t.string "alternative_phone"
+ t.string "company"
+ t.bigint "state_id"
+ t.bigint "country_id"
+ t.datetime "created_at", precision: 6, null: false
+ t.datetime "updated_at", precision: 6, null: false
+ t.bigint "user_id"
+ t.datetime "deleted_at"
+ t.string "label"
+ t.index ["country_id"], name: "index_spree_addresses_on_country_id"
+ t.index ["deleted_at"], name: "index_spree_addresses_on_deleted_at"
+ t.index ["firstname"], name: "index_addresses_on_firstname"
+ t.index ["lastname"], name: "index_addresses_on_lastname"
+ t.index ["state_id"], name: "index_spree_addresses_on_state_id"
+ t.index ["user_id"], name: "index_spree_addresses_on_user_id"
+ end
+
+ create_table "spree_adjustments", force: :cascade do |t|
+ t.string "source_type"
+ t.bigint "source_id"
+ t.string "adjustable_type"
+ t.bigint "adjustable_id"
+ t.decimal "amount", precision: 10, scale: 2
+ t.string "label"
+ t.boolean "mandatory"
+ t.boolean "eligible", default: true
+ t.datetime "created_at", precision: 6, null: false
+ t.datetime "updated_at", precision: 6, null: false
+ t.string "state"
+ t.bigint "order_id", null: false
+ t.boolean "included", default: false
+ t.index ["adjustable_id", "adjustable_type"], name: "index_spree_adjustments_on_adjustable_id_and_adjustable_type"
+ t.index ["eligible"], name: "index_spree_adjustments_on_eligible"
+ t.index ["order_id"], name: "index_spree_adjustments_on_order_id"
+ t.index ["source_id", "source_type"], name: "index_spree_adjustments_on_source_id_and_source_type"
+ end
+
+ create_table "spree_assets", force: :cascade do |t|
+ t.string "viewable_type"
+ t.bigint "viewable_id"
+ t.integer "attachment_width"
+ t.integer "attachment_height"
+ t.integer "attachment_file_size"
+ t.integer "position"
+ t.string "attachment_content_type"
+ t.string "attachment_file_name"
+ t.string "type", limit: 75
+ t.datetime "attachment_updated_at"
+ t.text "alt"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ t.index ["position"], name: "index_spree_assets_on_position"
+ t.index ["viewable_id"], name: "index_assets_on_viewable_id"
+ t.index ["viewable_type", "type"], name: "index_assets_on_viewable_type_and_type"
+ end
+
+ create_table "spree_calculators", force: :cascade do |t|
+ t.string "type"
+ t.string "calculable_type"
+ t.bigint "calculable_id"
+ t.datetime "created_at", precision: 6, null: false
+ t.datetime "updated_at", precision: 6, null: false
+ t.text "preferences"
+ t.datetime "deleted_at"
+ t.index ["calculable_id", "calculable_type"], name: "index_spree_calculators_on_calculable_id_and_calculable_type"
+ t.index ["deleted_at"], name: "index_spree_calculators_on_deleted_at"
+ t.index ["id", "type"], name: "index_spree_calculators_on_id_and_type"
+ end
+
+ create_table "spree_countries", force: :cascade do |t|
+ t.string "iso_name"
+ t.string "iso", null: false
+ t.string "iso3", null: false
+ t.string "name"
+ t.integer "numcode"
+ t.boolean "states_required", default: false
+ t.datetime "updated_at"
+ t.boolean "zipcode_required", default: true
+ t.datetime "created_at"
+ t.index ["iso_name"], name: "index_spree_countries_on_iso_name", unique: true
+ t.index ["name"], name: "index_spree_countries_on_name", unique: true
+ t.index ["iso"], name: "index_spree_countries_on_iso", unique: true
+ t.index ["iso3"], name: "index_spree_countries_on_iso3", unique: true
+ end
+
+ create_table "spree_credit_cards", force: :cascade do |t|
+ t.string "month"
+ t.string "year"
+ t.string "cc_type"
+ t.string "last_digits"
+ t.bigint "address_id"
+ t.string "gateway_customer_profile_id"
+ t.string "gateway_payment_profile_id"
+ t.datetime "created_at", precision: 6, null: false
+ t.datetime "updated_at", precision: 6, null: false
+ t.string "name"
+ t.bigint "user_id"
+ t.bigint "payment_method_id"
+ t.boolean "default", default: false, null: false
+ t.datetime "deleted_at"
+ t.index ["address_id"], name: "index_spree_credit_cards_on_address_id"
+ t.index ["deleted_at"], name: "index_spree_credit_cards_on_deleted_at"
+ t.index ["payment_method_id"], name: "index_spree_credit_cards_on_payment_method_id"
+ t.index ["user_id"], name: "index_spree_credit_cards_on_user_id"
+ end
+
+ create_table "spree_customer_returns", force: :cascade do |t|
+ t.string "number"
+ t.bigint "stock_location_id"
+ t.datetime "created_at", precision: 6, null: false
+ t.datetime "updated_at", precision: 6, null: false
+ t.bigint "store_id"
+ t.index ["number"], name: "index_spree_customer_returns_on_number", unique: true
+ t.index ["stock_location_id"], name: "index_spree_customer_returns_on_stock_location_id"
+ t.index ["store_id"], name: "index_spree_customer_returns_on_store_id"
+ end
+
+ create_table "spree_gateways", force: :cascade do |t|
+ t.string "type"
+ t.string "name"
+ t.text "description"
+ t.boolean "active", default: true
+ t.string "environment", default: "development"
+ t.string "server", default: "test"
+ t.boolean "test_mode", default: true
+ t.datetime "created_at", precision: 6, null: false
+ t.datetime "updated_at", precision: 6, null: false
+ t.text "preferences"
+ t.index ["active"], name: "index_spree_gateways_on_active"
+ t.index ["test_mode"], name: "index_spree_gateways_on_test_mode"
+ end
+
+ create_table "spree_inventory_units", force: :cascade do |t|
+ t.string "state"
+ t.bigint "variant_id"
+ t.bigint "order_id"
+ t.bigint "shipment_id"
+ t.datetime "created_at", precision: 6, null: false
+ t.datetime "updated_at", precision: 6, null: false
+ t.boolean "pending", default: true
+ t.bigint "line_item_id"
+ t.integer "quantity", default: 1
+ t.bigint "original_return_item_id"
+ t.index ["line_item_id"], name: "index_spree_inventory_units_on_line_item_id"
+ t.index ["order_id"], name: "index_inventory_units_on_order_id"
+ t.index ["original_return_item_id"], name: "index_spree_inventory_units_on_original_return_item_id"
+ t.index ["shipment_id"], name: "index_inventory_units_on_shipment_id"
+ t.index ["variant_id"], name: "index_inventory_units_on_variant_id"
+ end
+
+ create_table "spree_line_items", force: :cascade do |t|
+ t.bigint "variant_id"
+ t.bigint "order_id"
+ t.integer "quantity", null: false
+ t.decimal "price", precision: 10, scale: 2, null: false
+ t.datetime "created_at", precision: 6, null: false
+ t.datetime "updated_at", precision: 6, null: false
+ t.string "currency"
+ t.decimal "cost_price", precision: 10, scale: 2
+ t.bigint "tax_category_id"
+ t.decimal "adjustment_total", precision: 10, scale: 2, default: "0.0"
+ t.decimal "additional_tax_total", precision: 10, scale: 2, default: "0.0"
+ t.decimal "promo_total", precision: 10, scale: 2, default: "0.0"
+ t.decimal "included_tax_total", precision: 10, scale: 2, default: "0.0", null: false
+ t.decimal "pre_tax_amount", precision: 12, scale: 4, default: "0.0", null: false
+ t.decimal "taxable_adjustment_total", precision: 10, scale: 2, default: "0.0", null: false
+ t.decimal "non_taxable_adjustment_total", precision: 10, scale: 2, default: "0.0", null: false
+ t.index ["order_id"], name: "index_spree_line_items_on_order_id"
+ t.index ["tax_category_id"], name: "index_spree_line_items_on_tax_category_id"
+ t.index ["variant_id"], name: "index_spree_line_items_on_variant_id"
+ end
+
+ create_table "spree_log_entries", force: :cascade do |t|
+ t.string "source_type"
+ t.bigint "source_id"
+ t.text "details"
+ t.datetime "created_at", precision: 6, null: false
+ t.datetime "updated_at", precision: 6, null: false
+ t.index ["source_id", "source_type"], name: "index_spree_log_entries_on_source_id_and_source_type"
+ end
+
+ create_table "spree_option_type_prototypes", force: :cascade do |t|
+ t.bigint "prototype_id"
+ t.bigint "option_type_id"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ t.index ["option_type_id"], name: "index_spree_option_type_prototypes_on_option_type_id"
+ t.index ["prototype_id", "option_type_id"], name: "spree_option_type_prototypes_prototype_id_option_type_id", unique: true
+ t.index ["prototype_id"], name: "index_spree_option_type_prototypes_on_prototype_id"
+ end
+
+ create_table "spree_option_types", force: :cascade do |t|
+ t.string "name", limit: 100
+ t.string "presentation", limit: 100
+ t.integer "position", default: 0, null: false
+ t.datetime "created_at", precision: 6, null: false
+ t.datetime "updated_at", precision: 6, null: false
+ t.boolean "filterable", default: true, null: false
+ t.index ["filterable"], name: "index_spree_option_types_on_filterable"
+ t.index ["name"], name: "index_spree_option_types_on_name"
+ t.index ["position"], name: "index_spree_option_types_on_position"
+ end
+
+ create_table "spree_option_value_variants", force: :cascade do |t|
+ t.bigint "variant_id"
+ t.bigint "option_value_id"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ t.index ["option_value_id"], name: "index_spree_option_value_variants_on_option_value_id"
+ t.index ["variant_id", "option_value_id"], name: "index_option_values_variants_on_variant_id_and_option_value_id", unique: true
+ t.index ["variant_id"], name: "index_spree_option_value_variants_on_variant_id"
+ end
+
+ create_table "spree_option_values", force: :cascade do |t|
+ t.integer "position"
+ t.string "name"
+ t.string "presentation"
+ t.bigint "option_type_id"
+ t.datetime "created_at", precision: 6, null: false
+ t.datetime "updated_at", precision: 6, null: false
+ t.index ["name"], name: "index_spree_option_values_on_name"
+ t.index ["option_type_id"], name: "index_spree_option_values_on_option_type_id"
+ t.index ["position"], name: "index_spree_option_values_on_position"
+ end
+
+ create_table "spree_order_promotions", force: :cascade do |t|
+ t.bigint "order_id"
+ t.bigint "promotion_id"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ t.index ["order_id"], name: "index_spree_order_promotions_on_order_id"
+ t.index ["promotion_id", "order_id"], name: "index_spree_order_promotions_on_promotion_id_and_order_id"
+ t.index ["promotion_id"], name: "index_spree_order_promotions_on_promotion_id"
+ end
+
+ create_table "spree_orders", force: :cascade do |t|
+ t.string "number", limit: 32
+ t.decimal "item_total", precision: 10, scale: 2, default: "0.0", null: false
+ t.decimal "total", precision: 10, scale: 2, default: "0.0", null: false
+ t.string "state"
+ t.decimal "adjustment_total", precision: 10, scale: 2, default: "0.0", null: false
+ t.bigint "user_id"
+ t.datetime "completed_at"
+ t.bigint "bill_address_id"
+ t.bigint "ship_address_id"
+ t.decimal "payment_total", precision: 10, scale: 2, default: "0.0"
+ t.string "shipment_state"
+ t.string "payment_state"
+ t.string "email"
+ t.text "special_instructions"
+ t.datetime "created_at", precision: 6, null: false
+ t.datetime "updated_at", precision: 6, null: false
+ t.string "currency"
+ t.string "last_ip_address"
+ t.bigint "created_by_id"
+ t.decimal "shipment_total", precision: 10, scale: 2, default: "0.0", null: false
+ t.decimal "additional_tax_total", precision: 10, scale: 2, default: "0.0"
+ t.decimal "promo_total", precision: 10, scale: 2, default: "0.0"
+ t.string "channel", default: "spree"
+ t.decimal "included_tax_total", precision: 10, scale: 2, default: "0.0", null: false
+ t.integer "item_count", default: 0
+ t.bigint "approver_id"
+ t.datetime "approved_at"
+ t.boolean "confirmation_delivered", default: false
+ t.boolean "considered_risky", default: false
+ t.string "token"
+ t.datetime "canceled_at"
+ t.bigint "canceler_id"
+ t.bigint "store_id"
+ t.integer "state_lock_version", default: 0, null: false
+ t.decimal "taxable_adjustment_total", precision: 10, scale: 2, default: "0.0", null: false
+ t.decimal "non_taxable_adjustment_total", precision: 10, scale: 2, default: "0.0", null: false
+ t.boolean "store_owner_notification_delivered"
+ t.index ["approver_id"], name: "index_spree_orders_on_approver_id"
+ t.index ["bill_address_id"], name: "index_spree_orders_on_bill_address_id"
+ t.index ["canceler_id"], name: "index_spree_orders_on_canceler_id"
+ t.index ["completed_at"], name: "index_spree_orders_on_completed_at"
+ t.index ["confirmation_delivered"], name: "index_spree_orders_on_confirmation_delivered"
+ t.index ["considered_risky"], name: "index_spree_orders_on_considered_risky"
+ t.index ["created_by_id"], name: "index_spree_orders_on_created_by_id"
+ t.index ["number"], name: "index_spree_orders_on_number", unique: true
+ t.index ["ship_address_id"], name: "index_spree_orders_on_ship_address_id"
+ t.index ["store_id"], name: "index_spree_orders_on_store_id"
+ t.index ["token"], name: "index_spree_orders_on_token"
+ t.index ["user_id", "created_by_id"], name: "index_spree_orders_on_user_id_and_created_by_id"
+ end
+
+ create_table "spree_payment_capture_events", force: :cascade do |t|
+ t.decimal "amount", precision: 10, scale: 2, default: "0.0"
+ t.bigint "payment_id"
+ t.datetime "created_at", precision: 6, null: false
+ t.datetime "updated_at", precision: 6, null: false
+ t.index ["payment_id"], name: "index_spree_payment_capture_events_on_payment_id"
+ end
+
+ create_table "spree_payment_methods", force: :cascade do |t|
+ t.string "type"
+ t.string "name"
+ t.text "description"
+ t.boolean "active", default: true
+ t.datetime "deleted_at"
+ t.datetime "created_at", precision: 6, null: false
+ t.datetime "updated_at", precision: 6, null: false
+ t.string "display_on", default: "both"
+ t.boolean "auto_capture"
+ t.text "preferences"
+ t.integer "position", default: 0
+ t.index ["id", "type"], name: "index_spree_payment_methods_on_id_and_type"
+ end
+
+ create_table "spree_payment_methods_stores", id: false, force: :cascade do |t|
+ t.bigint "payment_method_id"
+ t.bigint "store_id"
+ t.index ["payment_method_id", "store_id"], name: "payment_mentod_id_store_id_unique_index", unique: true
+ t.index ["payment_method_id"], name: "index_spree_payment_methods_stores_on_payment_method_id"
+ t.index ["store_id"], name: "index_spree_payment_methods_stores_on_store_id"
+ end
+
+ create_table "spree_payments", force: :cascade do |t|
+ t.decimal "amount", precision: 10, scale: 2, default: "0.0", null: false
+ t.bigint "order_id"
+ t.string "source_type"
+ t.bigint "source_id"
+ t.bigint "payment_method_id"
+ t.string "state"
+ t.string "response_code"
+ t.string "avs_response"
+ t.datetime "created_at", precision: 6, null: false
+ t.datetime "updated_at", precision: 6, null: false
+ t.string "number"
+ t.string "cvv_response_code"
+ t.string "cvv_response_message"
+ t.index ["number"], name: "index_spree_payments_on_number", unique: true
+ t.index ["order_id"], name: "index_spree_payments_on_order_id"
+ t.index ["payment_method_id"], name: "index_spree_payments_on_payment_method_id"
+ t.index ["source_id", "source_type"], name: "index_spree_payments_on_source_id_and_source_type"
+ end
+
+ create_table "spree_preferences", force: :cascade do |t|
+ t.text "value"
+ t.string "key"
+ t.datetime "created_at", precision: 6, null: false
+ t.datetime "updated_at", precision: 6, null: false
+ t.index ["key"], name: "index_spree_preferences_on_key", unique: true
+ end
+
+ create_table "spree_prices", force: :cascade do |t|
+ t.bigint "variant_id", null: false
+ t.decimal "amount", precision: 10, scale: 2
+ t.string "currency"
+ t.datetime "deleted_at"
+ t.datetime "created_at", null: false
+ t.datetime "updated_at", null: false
+ t.decimal "compare_at_amount", precision: 10, scale: 2
+ t.index ["deleted_at"], name: "index_spree_prices_on_deleted_at"
+ t.index ["variant_id", "currency"], name: "index_spree_prices_on_variant_id_and_currency"
+ t.index ["variant_id"], name: "index_spree_prices_on_variant_id"
+ end
+
+ create_table "spree_product_option_types", force: :cascade do |t|
+ t.integer "position"
+ t.bigint "product_id"
+ t.bigint "option_type_id"
+ t.datetime "created_at", precision: 6, null: false
+ t.datetime "updated_at", precision: 6, null: false
+ t.index ["option_type_id"], name: "index_spree_product_option_types_on_option_type_id"
+ t.index ["position"], name: "index_spree_product_option_types_on_position"
+ t.index ["product_id"], name: "index_spree_product_option_types_on_product_id"
+ end
+
+ create_table "spree_product_promotion_rules", force: :cascade do |t|
+ t.bigint "product_id"
+ t.bigint "promotion_rule_id"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ t.index ["product_id"], name: "index_products_promotion_rules_on_product_id"
+ t.index ["promotion_rule_id", "product_id"], name: "index_products_promotion_rules_on_promotion_rule_and_product"
+ end
+
+ create_table "spree_products", force: :cascade do |t|
+ t.string "name", default: "", null: false
+ t.text "description"
+ t.datetime "available_on"
+ t.datetime "deleted_at"
+ t.string "slug"
+ t.text "meta_description"
+ t.string "meta_keywords"
+ t.bigint "tax_category_id"
+ t.bigint "shipping_category_id"
+ t.datetime "created_at", precision: 6, null: false
+ t.datetime "updated_at", precision: 6, null: false
+ t.boolean "promotionable", default: true
+ t.string "meta_title"
+ t.datetime "discontinue_on"
+ t.index ["available_on"], name: "index_spree_products_on_available_on"
+ t.index ["deleted_at"], name: "index_spree_products_on_deleted_at"
+ t.index ["discontinue_on"], name: "index_spree_products_on_discontinue_on"
+ t.index ["name"], name: "index_spree_products_on_name"
+ t.index ["shipping_category_id"], name: "index_spree_products_on_shipping_category_id"
+ t.index ["slug"], name: "index_spree_products_on_slug", unique: true
+ t.index ["tax_category_id"], name: "index_spree_products_on_tax_category_id"
+ end
+
+ create_table "spree_products_stores", force: :cascade do |t|
+ t.bigint "product_id"
+ t.bigint "store_id"
+ t.datetime "created_at", null: false
+ t.datetime "updated_at", null: false
+ t.index ["product_id", "store_id"], name: "index_spree_products_stores_on_product_id_and_store_id", unique: true
+ t.index ["product_id"], name: "index_spree_products_stores_on_product_id"
+ t.index ["store_id"], name: "index_spree_products_stores_on_store_id"
+ end
+
+ create_table "spree_products_taxons", force: :cascade do |t|
+ t.bigint "product_id"
+ t.bigint "taxon_id"
+ t.integer "position"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ t.index ["position"], name: "index_spree_products_taxons_on_position"
+ t.index ["product_id", "taxon_id"], name: "index_spree_products_taxons_on_product_id_and_taxon_id", unique: true
+ t.index ["product_id"], name: "index_spree_products_taxons_on_product_id"
+ t.index ["taxon_id"], name: "index_spree_products_taxons_on_taxon_id"
+ end
+
+ create_table "spree_promotion_action_line_items", force: :cascade do |t|
+ t.bigint "promotion_action_id"
+ t.bigint "variant_id"
+ t.integer "quantity", default: 1
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ t.index ["promotion_action_id"], name: "index_spree_promotion_action_line_items_on_promotion_action_id"
+ t.index ["variant_id"], name: "index_spree_promotion_action_line_items_on_variant_id"
+ end
+
+ create_table "spree_promotion_actions", force: :cascade do |t|
+ t.bigint "promotion_id"
+ t.integer "position"
+ t.string "type"
+ t.datetime "deleted_at"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ t.index ["deleted_at"], name: "index_spree_promotion_actions_on_deleted_at"
+ t.index ["id", "type"], name: "index_spree_promotion_actions_on_id_and_type"
+ t.index ["promotion_id"], name: "index_spree_promotion_actions_on_promotion_id"
+ end
+
+ create_table "spree_promotion_categories", force: :cascade do |t|
+ t.string "name"
+ t.datetime "created_at", precision: 6, null: false
+ t.datetime "updated_at", precision: 6, null: false
+ t.string "code"
+ end
+
+ create_table "spree_promotion_rule_taxons", force: :cascade do |t|
+ t.bigint "taxon_id"
+ t.bigint "promotion_rule_id"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ t.index ["promotion_rule_id"], name: "index_spree_promotion_rule_taxons_on_promotion_rule_id"
+ t.index ["taxon_id"], name: "index_spree_promotion_rule_taxons_on_taxon_id"
+ end
+
+ create_table "spree_promotion_rule_users", force: :cascade do |t|
+ t.bigint "user_id"
+ t.bigint "promotion_rule_id"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ t.index ["promotion_rule_id"], name: "index_promotion_rules_users_on_promotion_rule_id"
+ t.index ["user_id", "promotion_rule_id"], name: "index_promotion_rules_users_on_user_id_and_promotion_rule_id"
+ end
+
+ create_table "spree_promotion_rules", force: :cascade do |t|
+ t.bigint "promotion_id"
+ t.bigint "user_id"
+ t.bigint "product_group_id"
+ t.string "type"
+ t.datetime "created_at", precision: 6, null: false
+ t.datetime "updated_at", precision: 6, null: false
+ t.string "code"
+ t.text "preferences"
+ t.index ["product_group_id"], name: "index_promotion_rules_on_product_group_id"
+ t.index ["promotion_id"], name: "index_spree_promotion_rules_on_promotion_id"
+ t.index ["user_id"], name: "index_promotion_rules_on_user_id"
+ end
+
+ create_table "spree_promotions", force: :cascade do |t|
+ t.string "description"
+ t.datetime "expires_at"
+ t.datetime "starts_at"
+ t.string "name"
+ t.string "type"
+ t.integer "usage_limit"
+ t.string "match_policy", default: "all"
+ t.string "code"
+ t.boolean "advertise", default: false
+ t.string "path"
+ t.datetime "created_at", precision: 6, null: false
+ t.datetime "updated_at", precision: 6, null: false
+ t.bigint "promotion_category_id"
+ t.index ["advertise"], name: "index_spree_promotions_on_advertise"
+ t.index ["code"], name: "index_spree_promotions_on_code"
+ t.index ["expires_at"], name: "index_spree_promotions_on_expires_at"
+ t.index ["id", "type"], name: "index_spree_promotions_on_id_and_type"
+ t.index ["path"], name: "index_spree_promotions_on_path"
+ t.index ["promotion_category_id"], name: "index_spree_promotions_on_promotion_category_id"
+ t.index ["starts_at"], name: "index_spree_promotions_on_starts_at"
+ end
+
+ create_table "spree_promotions_stores", force: :cascade do |t|
+ t.bigint "promotion_id"
+ t.bigint "store_id"
+ t.datetime "created_at", null: false
+ t.datetime "updated_at", null: false
+ t.index ["promotion_id", "store_id"], name: "index_spree_promotions_stores_on_promotion_id_and_store_id", unique: true
+ t.index ["promotion_id"], name: "index_spree_promotions_stores_on_promotion_id"
+ t.index ["store_id"], name: "index_spree_promotions_stores_on_store_id"
+ end
+
+ create_table "spree_prototype_taxons", force: :cascade do |t|
+ t.bigint "taxon_id"
+ t.bigint "prototype_id"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ t.index ["prototype_id", "taxon_id"], name: "index_spree_prototype_taxons_on_prototype_id_and_taxon_id"
+ t.index ["prototype_id"], name: "index_spree_prototype_taxons_on_prototype_id"
+ t.index ["taxon_id"], name: "index_spree_prototype_taxons_on_taxon_id"
+ end
+
+ create_table "spree_prototypes", force: :cascade do |t|
+ t.string "name"
+ t.datetime "created_at", precision: 6, null: false
+ t.datetime "updated_at", precision: 6, null: false
+ end
+
+ create_table "spree_refund_reasons", force: :cascade do |t|
+ t.string "name"
+ t.boolean "active", default: true
+ t.boolean "mutable", default: true
+ t.datetime "created_at", precision: 6, null: false
+ t.datetime "updated_at", precision: 6, null: false
+ t.index ["name"], name: "index_spree_refund_reasons_on_name", unique: true
+ end
+
+ create_table "spree_refunds", force: :cascade do |t|
+ t.bigint "payment_id"
+ t.decimal "amount", precision: 10, scale: 2, default: "0.0", null: false
+ t.string "transaction_id"
+ t.datetime "created_at", precision: 6, null: false
+ t.datetime "updated_at", precision: 6, null: false
+ t.bigint "refund_reason_id"
+ t.bigint "reimbursement_id"
+ t.index ["payment_id"], name: "index_spree_refunds_on_payment_id"
+ t.index ["refund_reason_id"], name: "index_refunds_on_refund_reason_id"
+ t.index ["reimbursement_id"], name: "index_spree_refunds_on_reimbursement_id"
+ end
+
+ create_table "spree_reimbursement_credits", force: :cascade do |t|
+ t.decimal "amount", precision: 10, scale: 2, default: "0.0", null: false
+ t.bigint "reimbursement_id"
+ t.bigint "creditable_id"
+ t.string "creditable_type"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ t.index ["creditable_id", "creditable_type"], name: "index_reimbursement_credits_on_creditable_id_and_type"
+ t.index ["reimbursement_id"], name: "index_spree_reimbursement_credits_on_reimbursement_id"
+ end
+
+ create_table "spree_reimbursement_types", force: :cascade do |t|
+ t.string "name"
+ t.boolean "active", default: true
+ t.boolean "mutable", default: true
+ t.datetime "created_at", precision: 6, null: false
+ t.datetime "updated_at", precision: 6, null: false
+ t.string "type"
+ t.index ["name"], name: "index_spree_reimbursement_types_on_name", unique: true
+ t.index ["type"], name: "index_spree_reimbursement_types_on_type"
+ end
+
+ create_table "spree_reimbursements", force: :cascade do |t|
+ t.string "number"
+ t.string "reimbursement_status"
+ t.bigint "customer_return_id"
+ t.bigint "order_id"
+ t.decimal "total", precision: 10, scale: 2
+ t.datetime "created_at", precision: 6, null: false
+ t.datetime "updated_at", precision: 6, null: false
+ t.index ["customer_return_id"], name: "index_spree_reimbursements_on_customer_return_id"
+ t.index ["number"], name: "index_spree_reimbursements_on_number", unique: true
+ t.index ["order_id"], name: "index_spree_reimbursements_on_order_id"
+ end
+
+ create_table "spree_return_authorization_reasons", force: :cascade do |t|
+ t.string "name"
+ t.boolean "active", default: true
+ t.boolean "mutable", default: true
+ t.datetime "created_at", precision: 6, null: false
+ t.datetime "updated_at", precision: 6, null: false
+ t.index ["name"], name: "index_spree_return_authorization_reasons_on_name", unique: true
+ end
+
+ create_table "spree_return_authorizations", force: :cascade do |t|
+ t.string "number"
+ t.string "state"
+ t.bigint "order_id"
+ t.text "memo"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ t.bigint "stock_location_id"
+ t.bigint "return_authorization_reason_id"
+ t.index ["number"], name: "index_spree_return_authorizations_on_number", unique: true
+ t.index ["order_id"], name: "index_spree_return_authorizations_on_order_id"
+ t.index ["return_authorization_reason_id"], name: "index_return_authorizations_on_return_authorization_reason_id"
+ t.index ["stock_location_id"], name: "index_spree_return_authorizations_on_stock_location_id"
+ end
+
+ create_table "spree_return_items", force: :cascade do |t|
+ t.bigint "return_authorization_id"
+ t.bigint "inventory_unit_id"
+ t.bigint "exchange_variant_id"
+ t.datetime "created_at", precision: 6, null: false
+ t.datetime "updated_at", precision: 6, null: false
+ t.decimal "pre_tax_amount", precision: 12, scale: 4, default: "0.0", null: false
+ t.decimal "included_tax_total", precision: 12, scale: 4, default: "0.0", null: false
+ t.decimal "additional_tax_total", precision: 12, scale: 4, default: "0.0", null: false
+ t.string "reception_status"
+ t.string "acceptance_status"
+ t.bigint "customer_return_id"
+ t.bigint "reimbursement_id"
+ t.text "acceptance_status_errors"
+ t.bigint "preferred_reimbursement_type_id"
+ t.bigint "override_reimbursement_type_id"
+ t.boolean "resellable", default: true, null: false
+ t.index ["customer_return_id"], name: "index_return_items_on_customer_return_id"
+ t.index ["exchange_variant_id"], name: "index_spree_return_items_on_exchange_variant_id"
+ t.index ["inventory_unit_id"], name: "index_spree_return_items_on_inventory_unit_id"
+ t.index ["override_reimbursement_type_id"], name: "index_spree_return_items_on_override_reimbursement_type_id"
+ t.index ["preferred_reimbursement_type_id"], name: "index_spree_return_items_on_preferred_reimbursement_type_id"
+ t.index ["reimbursement_id"], name: "index_spree_return_items_on_reimbursement_id"
+ t.index ["return_authorization_id"], name: "index_spree_return_items_on_return_authorization_id"
+ end
+
+ create_table "spree_role_users", force: :cascade do |t|
+ t.bigint "role_id"
+ t.bigint "user_id"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ t.index ["role_id"], name: "index_spree_role_users_on_role_id"
+ t.index ["user_id"], name: "index_spree_role_users_on_user_id"
+ end
+
+ create_table "spree_roles", force: :cascade do |t|
+ t.string "name"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ t.index ["name"], name: "index_spree_roles_on_name", unique: true
+ end
+
+ create_table "spree_shipments", force: :cascade do |t|
+ t.string "tracking"
+ t.string "number"
+ t.decimal "cost", precision: 10, scale: 2, default: "0.0"
+ t.datetime "shipped_at"
+ t.bigint "order_id"
+ t.bigint "address_id"
+ t.string "state"
+ t.datetime "created_at", precision: 6, null: false
+ t.datetime "updated_at", precision: 6, null: false
+ t.bigint "stock_location_id"
+ t.decimal "adjustment_total", precision: 10, scale: 2, default: "0.0"
+ t.decimal "additional_tax_total", precision: 10, scale: 2, default: "0.0"
+ t.decimal "promo_total", precision: 10, scale: 2, default: "0.0"
+ t.decimal "included_tax_total", precision: 10, scale: 2, default: "0.0", null: false
+ t.decimal "pre_tax_amount", precision: 12, scale: 4, default: "0.0", null: false
+ t.decimal "taxable_adjustment_total", precision: 10, scale: 2, default: "0.0", null: false
+ t.decimal "non_taxable_adjustment_total", precision: 10, scale: 2, default: "0.0", null: false
+ t.index ["address_id"], name: "index_spree_shipments_on_address_id"
+ t.index ["number"], name: "index_spree_shipments_on_number", unique: true
+ t.index ["order_id"], name: "index_spree_shipments_on_order_id"
+ t.index ["stock_location_id"], name: "index_spree_shipments_on_stock_location_id"
+ end
+
+ create_table "spree_shipping_categories", force: :cascade do |t|
+ t.string "name"
+ t.datetime "created_at", precision: 6, null: false
+ t.datetime "updated_at", precision: 6, null: false
+ t.index ["name"], name: "index_spree_shipping_categories_on_name"
+ end
+
+ create_table "spree_shipping_method_categories", force: :cascade do |t|
+ t.bigint "shipping_method_id", null: false
+ t.bigint "shipping_category_id", null: false
+ t.datetime "created_at", precision: 6, null: false
+ t.datetime "updated_at", precision: 6, null: false
+ t.index ["shipping_category_id", "shipping_method_id"], name: "unique_spree_shipping_method_categories", unique: true
+ t.index ["shipping_category_id"], name: "index_spree_shipping_method_categories_on_shipping_category_id"
+ t.index ["shipping_method_id"], name: "index_spree_shipping_method_categories_on_shipping_method_id"
+ end
+
+ create_table "spree_shipping_method_zones", force: :cascade do |t|
+ t.bigint "shipping_method_id"
+ t.bigint "zone_id"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ t.index ["shipping_method_id"], name: "index_spree_shipping_method_zones_on_shipping_method_id"
+ t.index ["zone_id"], name: "index_spree_shipping_method_zones_on_zone_id"
+ end
+
+ create_table "spree_shipping_methods", force: :cascade do |t|
+ t.string "name"
+ t.string "display_on"
+ t.datetime "deleted_at"
+ t.datetime "created_at", precision: 6, null: false
+ t.datetime "updated_at", precision: 6, null: false
+ t.string "tracking_url"
+ t.string "admin_name"
+ t.bigint "tax_category_id"
+ t.string "code"
+ t.index ["deleted_at"], name: "index_spree_shipping_methods_on_deleted_at"
+ t.index ["tax_category_id"], name: "index_spree_shipping_methods_on_tax_category_id"
+ end
+
+ create_table "spree_shipping_rates", force: :cascade do |t|
+ t.bigint "shipment_id"
+ t.bigint "shipping_method_id"
+ t.boolean "selected", default: false
+ t.decimal "cost", precision: 8, scale: 2, default: "0.0"
+ t.datetime "created_at", precision: 6, null: false
+ t.datetime "updated_at", precision: 6, null: false
+ t.bigint "tax_rate_id"
+ t.index ["selected"], name: "index_spree_shipping_rates_on_selected"
+ t.index ["shipment_id", "shipping_method_id"], name: "spree_shipping_rates_join_index", unique: true
+ t.index ["shipment_id"], name: "index_spree_shipping_rates_on_shipment_id"
+ t.index ["shipping_method_id"], name: "index_spree_shipping_rates_on_shipping_method_id"
+ t.index ["tax_rate_id"], name: "index_spree_shipping_rates_on_tax_rate_id"
+ end
+
+ create_table "spree_state_changes", force: :cascade do |t|
+ t.string "name"
+ t.string "previous_state"
+ t.bigint "stateful_id"
+ t.bigint "user_id"
+ t.string "stateful_type"
+ t.string "next_state"
+ t.datetime "created_at", precision: 6, null: false
+ t.datetime "updated_at", precision: 6, null: false
+ t.index ["stateful_id", "stateful_type"], name: "index_spree_state_changes_on_stateful_id_and_stateful_type"
+ end
+
+ create_table "spree_states", force: :cascade do |t|
+ t.string "name"
+ t.string "abbr"
+ t.bigint "country_id"
+ t.datetime "updated_at"
+ t.datetime "created_at"
+ t.index ["country_id"], name: "index_spree_states_on_country_id"
+ end
+
+ create_table "spree_stock_items", force: :cascade do |t|
+ t.bigint "stock_location_id"
+ t.bigint "variant_id"
+ t.integer "count_on_hand", default: 0, null: false
+ t.datetime "created_at", precision: 6, null: false
+ t.datetime "updated_at", precision: 6, null: false
+ t.boolean "backorderable", default: false
+ t.datetime "deleted_at"
+ t.index ["backorderable"], name: "index_spree_stock_items_on_backorderable"
+ t.index ["deleted_at"], name: "index_spree_stock_items_on_deleted_at"
+ t.index ["stock_location_id", "variant_id"], name: "stock_item_by_loc_and_var_id"
+ t.index ["stock_location_id"], name: "index_spree_stock_items_on_stock_location_id"
+ t.index ["variant_id"], name: "index_spree_stock_items_on_variant_id"
+ end
+
+ create_table "spree_stock_locations", force: :cascade do |t|
+ t.string "name"
+ t.datetime "created_at", precision: 6, null: false
+ t.datetime "updated_at", precision: 6, null: false
+ t.boolean "default", default: false, null: false
+ t.string "address1"
+ t.string "address2"
+ t.string "city"
+ t.bigint "state_id"
+ t.string "state_name"
+ t.bigint "country_id"
+ t.string "zipcode"
+ t.string "phone"
+ t.boolean "active", default: true
+ t.boolean "backorderable_default", default: false
+ t.boolean "propagate_all_variants", default: true
+ t.string "admin_name"
+ t.index ["active"], name: "index_spree_stock_locations_on_active"
+ t.index ["backorderable_default"], name: "index_spree_stock_locations_on_backorderable_default"
+ t.index ["country_id"], name: "index_spree_stock_locations_on_country_id"
+ t.index ["propagate_all_variants"], name: "index_spree_stock_locations_on_propagate_all_variants"
+ t.index ["state_id"], name: "index_spree_stock_locations_on_state_id"
+ end
+
+ create_table "spree_stock_movements", force: :cascade do |t|
+ t.bigint "stock_item_id"
+ t.integer "quantity", default: 0
+ t.string "action"
+ t.datetime "created_at", precision: 6, null: false
+ t.datetime "updated_at", precision: 6, null: false
+ t.string "originator_type"
+ t.bigint "originator_id"
+ t.index ["originator_id", "originator_type"], name: "index_stock_movements_on_originator_id_and_originator_type"
+ t.index ["stock_item_id"], name: "index_spree_stock_movements_on_stock_item_id"
+ end
+
+ create_table "spree_stock_transfers", force: :cascade do |t|
+ t.string "type"
+ t.string "reference"
+ t.bigint "source_location_id"
+ t.bigint "destination_location_id"
+ t.datetime "created_at", precision: 6, null: false
+ t.datetime "updated_at", precision: 6, null: false
+ t.string "number"
+ t.index ["destination_location_id"], name: "index_spree_stock_transfers_on_destination_location_id"
+ t.index ["number"], name: "index_spree_stock_transfers_on_number", unique: true
+ t.index ["source_location_id"], name: "index_spree_stock_transfers_on_source_location_id"
+ end
+
+ create_table "spree_store_credit_categories", force: :cascade do |t|
+ t.string "name"
+ t.datetime "created_at", precision: 6, null: false
+ t.datetime "updated_at", precision: 6, null: false
+ end
+
+ create_table "spree_store_credit_events", force: :cascade do |t|
+ t.bigint "store_credit_id", null: false
+ t.string "action", null: false
+ t.decimal "amount", precision: 8, scale: 2
+ t.string "authorization_code", null: false
+ t.decimal "user_total_amount", precision: 8, scale: 2, default: "0.0", null: false
+ t.bigint "originator_id"
+ t.string "originator_type"
+ t.datetime "deleted_at"
+ t.datetime "created_at", precision: 6, null: false
+ t.datetime "updated_at", precision: 6, null: false
+ t.index ["originator_id", "originator_type"], name: "spree_store_credit_events_originator"
+ t.index ["store_credit_id"], name: "index_spree_store_credit_events_on_store_credit_id"
+ end
+
+ create_table "spree_store_credit_types", force: :cascade do |t|
+ t.string "name"
+ t.integer "priority"
+ t.datetime "created_at", precision: 6, null: false
+ t.datetime "updated_at", precision: 6, null: false
+ t.index ["priority"], name: "index_spree_store_credit_types_on_priority"
+ end
+
+ create_table "spree_store_credits", force: :cascade do |t|
+ t.bigint "user_id"
+ t.bigint "category_id"
+ t.bigint "created_by_id"
+ t.decimal "amount", precision: 8, scale: 2, default: "0.0", null: false
+ t.decimal "amount_used", precision: 8, scale: 2, default: "0.0", null: false
+ t.text "memo"
+ t.datetime "deleted_at"
+ t.string "currency"
+ t.decimal "amount_authorized", precision: 8, scale: 2, default: "0.0", null: false
+ t.bigint "originator_id"
+ t.string "originator_type"
+ t.bigint "type_id"
+ t.datetime "created_at", precision: 6, null: false
+ t.datetime "updated_at", precision: 6, null: false
+ t.bigint "store_id"
+ t.index ["deleted_at"], name: "index_spree_store_credits_on_deleted_at"
+ t.index ["originator_id", "originator_type"], name: "spree_store_credits_originator"
+ t.index ["store_id"], name: "index_spree_store_credits_on_store_id"
+ t.index ["type_id"], name: "index_spree_store_credits_on_type_id"
+ t.index ["user_id"], name: "index_spree_store_credits_on_user_id"
+ end
+
+ create_table "spree_stores", force: :cascade do |t|
+ t.string "name"
+ t.string "url"
+ t.text "meta_description"
+ t.text "meta_keywords"
+ t.string "seo_title"
+ t.string "mail_from_address"
+ t.string "default_currency"
+ t.string "code"
+ t.boolean "default", default: false, null: false
+ t.datetime "created_at", precision: 6, null: false
+ t.datetime "updated_at", precision: 6, null: false
+ t.string "supported_currencies"
+ t.string "facebook"
+ t.string "twitter"
+ t.string "instagram"
+ t.string "default_locale"
+ t.string "customer_support_email"
+ t.bigint "default_country_id"
+ t.text "description"
+ t.text "address"
+ t.string "contact_phone"
+ t.string "new_order_notifications_email"
+ t.bigint "checkout_zone_id"
+ t.string "seo_robots"
+ t.string "supported_locales"
+ t.index ["code"], name: "index_spree_stores_on_code", unique: true
+ t.index ["default"], name: "index_spree_stores_on_default"
+ t.index ["url"], name: "index_spree_stores_on_url"
+ end
+
+ create_table "spree_tax_categories", force: :cascade do |t|
+ t.string "name"
+ t.string "description"
+ t.boolean "is_default", default: false
+ t.datetime "deleted_at"
+ t.datetime "created_at", precision: 6, null: false
+ t.datetime "updated_at", precision: 6, null: false
+ t.string "tax_code"
+ t.index ["deleted_at"], name: "index_spree_tax_categories_on_deleted_at"
+ t.index ["is_default"], name: "index_spree_tax_categories_on_is_default"
+ end
+
+ create_table "spree_tax_rates", force: :cascade do |t|
+ t.decimal "amount", precision: 8, scale: 5
+ t.bigint "zone_id"
+ t.bigint "tax_category_id"
+ t.boolean "included_in_price", default: false
+ t.datetime "created_at", precision: 6, null: false
+ t.datetime "updated_at", precision: 6, null: false
+ t.string "name"
+ t.boolean "show_rate_in_label", default: true
+ t.datetime "deleted_at"
+ t.index ["deleted_at"], name: "index_spree_tax_rates_on_deleted_at"
+ t.index ["included_in_price"], name: "index_spree_tax_rates_on_included_in_price"
+ t.index ["show_rate_in_label"], name: "index_spree_tax_rates_on_show_rate_in_label"
+ t.index ["tax_category_id"], name: "index_spree_tax_rates_on_tax_category_id"
+ t.index ["zone_id"], name: "index_spree_tax_rates_on_zone_id"
+ end
+
+ create_table "spree_taxonomies", force: :cascade do |t|
+ t.string "name", null: false
+ t.datetime "created_at", precision: 6, null: false
+ t.datetime "updated_at", precision: 6, null: false
+ t.integer "position", default: 0
+ t.bigint "store_id"
+ t.index ["name", "store_id"], name: "index_spree_taxonomies_on_name_and_store_id", unique: true
+ t.index ["position"], name: "index_spree_taxonomies_on_position"
+ t.index ["store_id"], name: "index_spree_taxonomies_on_store_id"
+ end
+
+ create_table "spree_taxons", force: :cascade do |t|
+ t.bigint "parent_id"
+ t.integer "position", default: 0
+ t.string "name", null: false
+ t.string "permalink"
+ t.bigint "taxonomy_id"
+ t.bigint "lft"
+ t.bigint "rgt"
+ t.text "description"
+ t.datetime "created_at", precision: 6, null: false
+ t.datetime "updated_at", precision: 6, null: false
+ t.string "meta_title"
+ t.string "meta_description"
+ t.string "meta_keywords"
+ t.integer "depth"
+ t.boolean "hide_from_nav", default: false
+ t.index ["lft"], name: "index_spree_taxons_on_lft"
+ t.index ["name", "parent_id", "taxonomy_id"], name: "index_spree_taxons_on_name_and_parent_id_and_taxonomy_id", unique: true
+ t.index ["name"], name: "index_spree_taxons_on_name"
+ t.index ["parent_id"], name: "index_taxons_on_parent_id"
+ t.index ["permalink", "parent_id", "taxonomy_id"], name: "index_spree_taxons_on_permalink_and_parent_id_and_taxonomy_id", unique: true
+ t.index ["permalink"], name: "index_taxons_on_permalink"
+ t.index ["position"], name: "index_spree_taxons_on_position"
+ t.index ["rgt"], name: "index_spree_taxons_on_rgt"
+ t.index ["taxonomy_id"], name: "index_taxons_on_taxonomy_id"
+ end
+
+ create_table "spree_trackers", force: :cascade do |t|
+ t.string "analytics_id"
+ t.boolean "active", default: true
+ t.datetime "created_at", precision: 6, null: false
+ t.datetime "updated_at", precision: 6, null: false
+ t.integer "engine", default: 0, null: false
+ t.index ["active"], name: "index_spree_trackers_on_active"
+ end
+
+ create_table "spree_users", force: :cascade do |t|
+ t.string "encrypted_password", limit: 128
+ t.string "password_salt", limit: 128
+ t.string "email"
+ t.string "remember_token"
+ t.string "persistence_token"
+ t.string "reset_password_token"
+ t.string "perishable_token"
+ t.integer "sign_in_count", default: 0, null: false
+ t.integer "failed_attempts", default: 0, null: false
+ t.datetime "last_request_at"
+ t.datetime "current_sign_in_at"
+ t.datetime "last_sign_in_at"
+ t.string "current_sign_in_ip"
+ t.string "last_sign_in_ip"
+ t.string "login"
+ t.bigint "ship_address_id"
+ t.bigint "bill_address_id"
+ t.string "authentication_token"
+ t.string "unlock_token"
+ t.datetime "locked_at"
+ t.datetime "remember_created_at"
+ t.datetime "reset_password_sent_at"
+ t.datetime "created_at", precision: 6, null: false
+ t.datetime "updated_at", precision: 6, null: false
+ end
+
+ create_table "spree_variants", force: :cascade do |t|
+ t.string "sku", default: "", null: false
+ t.decimal "weight", precision: 8, scale: 2, default: "0.0"
+ t.decimal "height", precision: 8, scale: 2
+ t.decimal "width", precision: 8, scale: 2
+ t.decimal "depth", precision: 8, scale: 2
+ t.datetime "deleted_at"
+ t.boolean "is_master", default: false
+ t.bigint "product_id"
+ t.decimal "cost_price", precision: 10, scale: 2
+ t.integer "position"
+ t.string "cost_currency"
+ t.boolean "track_inventory", default: true
+ t.bigint "tax_category_id"
+ t.datetime "updated_at", null: false
+ t.datetime "discontinue_on"
+ t.datetime "created_at", null: false
+ t.index ["deleted_at"], name: "index_spree_variants_on_deleted_at"
+ t.index ["discontinue_on"], name: "index_spree_variants_on_discontinue_on"
+ t.index ["is_master"], name: "index_spree_variants_on_is_master"
+ t.index ["position"], name: "index_spree_variants_on_position"
+ t.index ["product_id"], name: "index_spree_variants_on_product_id"
+ t.index ["sku"], name: "index_spree_variants_on_sku"
+ t.index ["tax_category_id"], name: "index_spree_variants_on_tax_category_id"
+ t.index ["track_inventory"], name: "index_spree_variants_on_track_inventory"
+ end
+
+ create_table "spree_zone_members", force: :cascade do |t|
+ t.string "zoneable_type"
+ t.bigint "zoneable_id"
+ t.bigint "zone_id"
+ t.datetime "created_at", precision: 6, null: false
+ t.datetime "updated_at", precision: 6, null: false
+ t.index ["zone_id"], name: "index_spree_zone_members_on_zone_id"
+ t.index ["zoneable_id", "zoneable_type"], name: "index_spree_zone_members_on_zoneable_id_and_zoneable_type"
+ end
+
+ create_table "spree_zones", force: :cascade do |t|
+ t.string "name"
+ t.string "description"
+ t.boolean "default_tax", default: false
+ t.integer "zone_members_count", default: 0
+ t.datetime "created_at", precision: 6, null: false
+ t.datetime "updated_at", precision: 6, null: false
+ t.string "kind", default: "state"
+ t.index ["default_tax"], name: "index_spree_zones_on_default_tax"
+ t.index ["kind"], name: "index_spree_zones_on_kind"
+ end
+ end
+end
diff --git a/server/db/migrate/20260317145960_add_metadata_to_spree_orders.spree.rb b/server/db/migrate/20260317145960_add_metadata_to_spree_orders.spree.rb
new file mode 100644
index 0000000000..52d4e34f7f
--- /dev/null
+++ b/server/db/migrate/20260317145960_add_metadata_to_spree_orders.spree.rb
@@ -0,0 +1,14 @@
+# This migration comes from spree (originally 20210915064321)
+class AddMetadataToSpreeOrders < ActiveRecord::Migration[5.2]
+ def change
+ change_table :spree_orders do |t|
+ if t.respond_to? :jsonb
+ add_column :spree_orders, :public_metadata, :jsonb
+ add_column :spree_orders, :private_metadata, :jsonb
+ else
+ add_column :spree_orders, :public_metadata, :json
+ add_column :spree_orders, :private_metadata, :json
+ end
+ end
+ end
+end
diff --git a/server/db/migrate/20260317145961_add_metadata_to_spree_products.spree.rb b/server/db/migrate/20260317145961_add_metadata_to_spree_products.spree.rb
new file mode 100644
index 0000000000..f536e3cf59
--- /dev/null
+++ b/server/db/migrate/20260317145961_add_metadata_to_spree_products.spree.rb
@@ -0,0 +1,14 @@
+# This migration comes from spree (originally 20210915064322)
+class AddMetadataToSpreeProducts < ActiveRecord::Migration[5.2]
+ def change
+ change_table :spree_products do |t|
+ if t.respond_to? :jsonb
+ add_column :spree_products, :public_metadata, :jsonb
+ add_column :spree_products, :private_metadata, :jsonb
+ else
+ add_column :spree_products, :public_metadata, :json
+ add_column :spree_products, :private_metadata, :json
+ end
+ end
+ end
+end
diff --git a/server/db/migrate/20260317145962_add_metadata_to_spree_variants.spree.rb b/server/db/migrate/20260317145962_add_metadata_to_spree_variants.spree.rb
new file mode 100644
index 0000000000..6db507fe13
--- /dev/null
+++ b/server/db/migrate/20260317145962_add_metadata_to_spree_variants.spree.rb
@@ -0,0 +1,14 @@
+# This migration comes from spree (originally 20210915064323)
+class AddMetadataToSpreeVariants < ActiveRecord::Migration[5.2]
+ def change
+ change_table :spree_variants do |t|
+ if t.respond_to? :jsonb
+ add_column :spree_variants, :public_metadata, :jsonb
+ add_column :spree_variants, :private_metadata, :jsonb
+ else
+ add_column :spree_variants, :public_metadata, :json
+ add_column :spree_variants, :private_metadata, :json
+ end
+ end
+ end
+end
diff --git a/server/db/migrate/20260317145963_add_metadata_to_spree_line_items.spree.rb b/server/db/migrate/20260317145963_add_metadata_to_spree_line_items.spree.rb
new file mode 100644
index 0000000000..86103f6ae8
--- /dev/null
+++ b/server/db/migrate/20260317145963_add_metadata_to_spree_line_items.spree.rb
@@ -0,0 +1,14 @@
+# This migration comes from spree (originally 20210915064324)
+class AddMetadataToSpreeLineItems < ActiveRecord::Migration[5.2]
+ def change
+ change_table :spree_line_items do |t|
+ if t.respond_to? :jsonb
+ add_column :spree_line_items, :public_metadata, :jsonb
+ add_column :spree_line_items, :private_metadata, :jsonb
+ else
+ add_column :spree_line_items, :public_metadata, :json
+ add_column :spree_line_items, :private_metadata, :json
+ end
+ end
+ end
+end
diff --git a/server/db/migrate/20260317145964_add_metadata_to_spree_shipments.spree.rb b/server/db/migrate/20260317145964_add_metadata_to_spree_shipments.spree.rb
new file mode 100644
index 0000000000..e56973b801
--- /dev/null
+++ b/server/db/migrate/20260317145964_add_metadata_to_spree_shipments.spree.rb
@@ -0,0 +1,14 @@
+# This migration comes from spree (originally 20210915064325)
+class AddMetadataToSpreeShipments < ActiveRecord::Migration[5.2]
+ def change
+ change_table :spree_shipments do |t|
+ if t.respond_to? :jsonb
+ add_column :spree_shipments, :public_metadata, :jsonb
+ add_column :spree_shipments, :private_metadata, :jsonb
+ else
+ add_column :spree_shipments, :public_metadata, :json
+ add_column :spree_shipments, :private_metadata, :json
+ end
+ end
+ end
+end
diff --git a/server/db/migrate/20260317145965_add_metadata_to_spree_payments.spree.rb b/server/db/migrate/20260317145965_add_metadata_to_spree_payments.spree.rb
new file mode 100644
index 0000000000..42dd39d59c
--- /dev/null
+++ b/server/db/migrate/20260317145965_add_metadata_to_spree_payments.spree.rb
@@ -0,0 +1,14 @@
+# This migration comes from spree (originally 20210915064326)
+class AddMetadataToSpreePayments < ActiveRecord::Migration[5.2]
+ def change
+ change_table :spree_payments do |t|
+ if t.respond_to? :jsonb
+ add_column :spree_payments, :public_metadata, :jsonb
+ add_column :spree_payments, :private_metadata, :jsonb
+ else
+ add_column :spree_payments, :public_metadata, :json
+ add_column :spree_payments, :private_metadata, :json
+ end
+ end
+ end
+end
diff --git a/server/db/migrate/20260317145966_add_metadata_to_spree_taxons_and_taxonomies.spree.rb b/server/db/migrate/20260317145966_add_metadata_to_spree_taxons_and_taxonomies.spree.rb
new file mode 100644
index 0000000000..efa9153ffe
--- /dev/null
+++ b/server/db/migrate/20260317145966_add_metadata_to_spree_taxons_and_taxonomies.spree.rb
@@ -0,0 +1,19 @@
+# This migration comes from spree (originally 20210915064327)
+class AddMetadataToSpreeTaxonsAndTaxonomies < ActiveRecord::Migration[5.2]
+ def change
+ %i[
+ spree_taxons
+ spree_taxonomies
+ ].each do |table_name|
+ change_table table_name do |t|
+ if t.respond_to? :jsonb
+ add_column table_name, :public_metadata, :jsonb
+ add_column table_name, :private_metadata, :jsonb
+ else
+ add_column table_name, :public_metadata, :json
+ add_column table_name, :private_metadata, :json
+ end
+ end
+ end
+ end
+end
diff --git a/server/db/migrate/20260317145967_add_metadata_to_spree_stock_transfers.spree.rb b/server/db/migrate/20260317145967_add_metadata_to_spree_stock_transfers.spree.rb
new file mode 100644
index 0000000000..3143291d92
--- /dev/null
+++ b/server/db/migrate/20260317145967_add_metadata_to_spree_stock_transfers.spree.rb
@@ -0,0 +1,14 @@
+# This migration comes from spree (originally 20210915064328)
+class AddMetadataToSpreeStockTransfers < ActiveRecord::Migration[5.2]
+ def change
+ change_table :spree_stock_transfers do |t|
+ if t.respond_to? :jsonb
+ add_column :spree_stock_transfers, :public_metadata, :jsonb
+ add_column :spree_stock_transfers, :private_metadata, :jsonb
+ else
+ add_column :spree_stock_transfers, :public_metadata, :json
+ add_column :spree_stock_transfers, :private_metadata, :json
+ end
+ end
+ end
+end
diff --git a/server/db/migrate/20260317145968_add_metadata_to_spree_multiple_tables.spree.rb b/server/db/migrate/20260317145968_add_metadata_to_spree_multiple_tables.spree.rb
new file mode 100644
index 0000000000..7d204f589c
--- /dev/null
+++ b/server/db/migrate/20260317145968_add_metadata_to_spree_multiple_tables.spree.rb
@@ -0,0 +1,30 @@
+# This migration comes from spree (originally 20210915064329)
+class AddMetadataToSpreeMultipleTables < ActiveRecord::Migration[5.2]
+ def change
+ %i[
+ spree_assets
+ spree_option_types
+ spree_option_values
+ spree_promotions
+ spree_payment_methods
+ spree_shipping_methods
+ spree_prototypes
+ spree_refunds
+ spree_customer_returns
+ spree_users
+ spree_addresses
+ spree_credit_cards
+ spree_store_credits
+ ].each do |table_name|
+ change_table table_name do |t|
+ if t.respond_to? :jsonb
+ add_column table_name, :public_metadata, :jsonb
+ add_column table_name, :private_metadata, :jsonb
+ else
+ add_column table_name, :public_metadata, :json
+ add_column table_name, :private_metadata, :json
+ end
+ end
+ end
+ end
+end
diff --git a/server/db/migrate/20260317145969_add_deleted_at_to_spree_stores.spree.rb b/server/db/migrate/20260317145969_add_deleted_at_to_spree_stores.spree.rb
new file mode 100644
index 0000000000..5ee5ac0bec
--- /dev/null
+++ b/server/db/migrate/20260317145969_add_deleted_at_to_spree_stores.spree.rb
@@ -0,0 +1,9 @@
+# This migration comes from spree (originally 20210920090344)
+class AddDeletedAtToSpreeStores < ActiveRecord::Migration[5.2]
+ def change
+ unless column_exists?(:spree_stores, :deleted_at)
+ add_column :spree_stores, :deleted_at, :datetime
+ add_index :spree_stores, :deleted_at
+ end
+ end
+end
diff --git a/server/db/migrate/20260317145970_rename_column_access_hash_to_token.spree.rb b/server/db/migrate/20260317145970_rename_column_access_hash_to_token.spree.rb
new file mode 100644
index 0000000000..44d49c91f5
--- /dev/null
+++ b/server/db/migrate/20260317145970_rename_column_access_hash_to_token.spree.rb
@@ -0,0 +1,9 @@
+# This migration comes from spree (originally 20210921070812)
+class RenameColumnAccessHashToToken < ActiveRecord::Migration[5.2]
+ def change
+ if table_exists?(:spree_wishlists)
+ rename_column(:spree_wishlists, :access_hash, :token) if column_exists?(:spree_wishlists, :access_hash)
+ add_reference(:spree_wishlists, :store, index: true) unless column_exists?(:spree_wishlists, :store_id)
+ end
+ end
+end
diff --git a/server/db/migrate/20260317145971_create_spree_wishlists.spree.rb b/server/db/migrate/20260317145971_create_spree_wishlists.spree.rb
new file mode 100644
index 0000000000..a84edd9012
--- /dev/null
+++ b/server/db/migrate/20260317145971_create_spree_wishlists.spree.rb
@@ -0,0 +1,19 @@
+# This migration comes from spree (originally 20210921070813)
+class CreateSpreeWishlists < ActiveRecord::Migration[5.2]
+ def change
+ create_table :spree_wishlists, if_not_exists: true do |t|
+ t.belongs_to :user
+ t.belongs_to :store
+
+ t.column :name, :string
+ t.column :token, :string, null: false
+ t.column :is_private, :boolean, default: true, null: false
+ t.column :is_default, :boolean, default: false, null: false
+
+ t.timestamps
+ end
+
+ add_index :spree_wishlists, :token, unique: true
+ add_index :spree_wishlists, [:user_id, :is_default] unless index_exists?(:spree_wishlists, [:user_id, :is_default])
+ end
+end
diff --git a/server/db/migrate/20260317145972_create_spree_wished_products.spree.rb b/server/db/migrate/20260317145972_create_spree_wished_products.spree.rb
new file mode 100644
index 0000000000..5811a48691
--- /dev/null
+++ b/server/db/migrate/20260317145972_create_spree_wished_products.spree.rb
@@ -0,0 +1,17 @@
+# This migration comes from spree (originally 20210921070814)
+class CreateSpreeWishedProducts < ActiveRecord::Migration[5.2]
+ def change
+ create_table :spree_wished_products, if_not_exists: true do |t|
+ t.references :variant
+ t.belongs_to :wishlist
+
+ t.column :quantity, :integer, default: 1, null: false
+
+ t.timestamps
+ end
+
+ add_index :spree_wished_products, [:variant_id, :wishlist_id], unique: true unless index_exists?(:spree_wished_products, [:variant_id, :wishlist_id])
+ add_index :spree_wished_products, :variant_id unless index_exists?(:spree_wished_products, :variant_id)
+ add_index :spree_wished_products, :wishlist_id unless index_exists?(:spree_wished_products, :wishlist_id)
+ end
+end
diff --git a/server/db/migrate/20260317145973_rename_spree_wished_products_to_spree_wished_items.spree.rb b/server/db/migrate/20260317145973_rename_spree_wished_products_to_spree_wished_items.spree.rb
new file mode 100644
index 0000000000..a38e49880b
--- /dev/null
+++ b/server/db/migrate/20260317145973_rename_spree_wished_products_to_spree_wished_items.spree.rb
@@ -0,0 +1,6 @@
+# This migration comes from spree (originally 20210921070815)
+class RenameSpreeWishedProductsToSpreeWishedItems < ActiveRecord::Migration[5.2]
+ def change
+ rename_table :spree_wished_products, :spree_wished_items
+ end
+end
diff --git a/server/db/migrate/20260317145974_add_unique_stock_item_stock_location_variant_deleted_at_index.spree.rb b/server/db/migrate/20260317145974_add_unique_stock_item_stock_location_variant_deleted_at_index.spree.rb
new file mode 100644
index 0000000000..24337f56c8
--- /dev/null
+++ b/server/db/migrate/20260317145974_add_unique_stock_item_stock_location_variant_deleted_at_index.spree.rb
@@ -0,0 +1,6 @@
+# This migration comes from spree (originally 20210921090344)
+class AddUniqueStockItemStockLocationVariantDeletedAtIndex < ActiveRecord::Migration[5.2]
+ def change
+ add_index :spree_stock_items, [:stock_location_id, :variant_id, :deleted_at], name: 'stock_item_by_loc_var_id_deleted_at', unique: true
+ end
+end
diff --git a/server/db/migrate/20260317145975_create_stock_item_stock_location_id_variant_id_coalesce_deleted_at_unique_index.spree.rb b/server/db/migrate/20260317145975_create_stock_item_stock_location_id_variant_id_coalesce_deleted_at_unique_index.spree.rb
new file mode 100644
index 0000000000..0749478269
--- /dev/null
+++ b/server/db/migrate/20260317145975_create_stock_item_stock_location_id_variant_id_coalesce_deleted_at_unique_index.spree.rb
@@ -0,0 +1,6 @@
+# This migration comes from spree (originally 20210929090344)
+class CreateStockItemStockLocationIdVariantIdCoalesceDeletedAtUniqueIndex < ActiveRecord::Migration[5.2]
+ def change
+ # this migration was broken and is fixed in the following migration
+ end
+end
diff --git a/server/db/migrate/20260317145976_create_spree_digital_links.spree.rb b/server/db/migrate/20260317145976_create_spree_digital_links.spree.rb
new file mode 100644
index 0000000000..2340667be3
--- /dev/null
+++ b/server/db/migrate/20260317145976_create_spree_digital_links.spree.rb
@@ -0,0 +1,14 @@
+# This migration comes from spree (originally 20210929091444)
+class CreateSpreeDigitalLinks < ActiveRecord::Migration[5.2]
+ def change
+ create_table :spree_digital_links, if_not_exists: true do |t|
+ t.belongs_to :digital
+ t.belongs_to :line_item
+ t.string :secret
+ t.integer :access_counter
+
+ t.timestamps
+ end
+ add_index :spree_digital_links, :secret, unique: true unless index_exists?(:spree_digital_links, :secret)
+ end
+end
diff --git a/server/db/migrate/20260317145977_create_spree_digitals.spree.rb b/server/db/migrate/20260317145977_create_spree_digitals.spree.rb
new file mode 100644
index 0000000000..f6ae40b0e8
--- /dev/null
+++ b/server/db/migrate/20260317145977_create_spree_digitals.spree.rb
@@ -0,0 +1,10 @@
+# This migration comes from spree (originally 20210929093238)
+class CreateSpreeDigitals < ActiveRecord::Migration[5.2]
+ def change
+ create_table :spree_digitals, if_not_exists: true do |t|
+ t.belongs_to :variant
+
+ t.timestamps
+ end
+ end
+end
diff --git a/server/db/migrate/20260317145978_rename_secret_to_token_on_spree_digital_links.spree.rb b/server/db/migrate/20260317145978_rename_secret_to_token_on_spree_digital_links.spree.rb
new file mode 100644
index 0000000000..7c42f776a7
--- /dev/null
+++ b/server/db/migrate/20260317145978_rename_secret_to_token_on_spree_digital_links.spree.rb
@@ -0,0 +1,6 @@
+# This migration comes from spree (originally 20210930143043)
+class RenameSecretToTokenOnSpreeDigitalLinks < ActiveRecord::Migration[5.2]
+ def change
+ rename_column :spree_digital_links, :secret, :token
+ end
+end
diff --git a/server/db/migrate/20260317145979_add_settings_to_spree_stores.spree.rb b/server/db/migrate/20260317145979_add_settings_to_spree_stores.spree.rb
new file mode 100644
index 0000000000..1dcb13f025
--- /dev/null
+++ b/server/db/migrate/20260317145979_add_settings_to_spree_stores.spree.rb
@@ -0,0 +1,12 @@
+# This migration comes from spree (originally 20210930155649)
+class AddSettingsToSpreeStores < ActiveRecord::Migration[5.2]
+ def change
+ change_table :spree_stores do |t|
+ if t.respond_to? :jsonb
+ add_column :spree_stores, :settings, :jsonb
+ else
+ add_column :spree_stores, :settings, :json
+ end
+ end
+ end
+end
diff --git a/server/db/migrate/20260317145980_add_settings_to_payment_methods.spree.rb b/server/db/migrate/20260317145980_add_settings_to_payment_methods.spree.rb
new file mode 100644
index 0000000000..5c68a97827
--- /dev/null
+++ b/server/db/migrate/20260317145980_add_settings_to_payment_methods.spree.rb
@@ -0,0 +1,12 @@
+# This migration comes from spree (originally 20211203082008)
+class AddSettingsToPaymentMethods < ActiveRecord::Migration[5.2]
+ def change
+ change_table :spree_payment_methods do |t|
+ if t.respond_to? :jsonb
+ add_column :spree_payment_methods, :settings, :jsonb
+ else
+ add_column :spree_payment_methods, :settings, :json
+ end
+ end
+ end
+end
diff --git a/server/db/migrate/20260317145981_disable_propagate_all_variants_by_default.spree.rb b/server/db/migrate/20260317145981_disable_propagate_all_variants_by_default.spree.rb
new file mode 100644
index 0000000000..f8593808fc
--- /dev/null
+++ b/server/db/migrate/20260317145981_disable_propagate_all_variants_by_default.spree.rb
@@ -0,0 +1,6 @@
+# This migration comes from spree (originally 20211229162122)
+class DisablePropagateAllVariantsByDefault < ActiveRecord::Migration[5.2]
+ def change
+ change_column_default :spree_stock_locations, :propagate_all_variants, false
+ end
+end
diff --git a/server/db/migrate/20260317145982_add_status_and_make_active_at_to_spree_products.spree.rb b/server/db/migrate/20260317145982_add_status_and_make_active_at_to_spree_products.spree.rb
new file mode 100644
index 0000000000..763beb2797
--- /dev/null
+++ b/server/db/migrate/20260317145982_add_status_and_make_active_at_to_spree_products.spree.rb
@@ -0,0 +1,8 @@
+# This migration comes from spree (originally 20220103082046)
+class AddStatusAndMakeActiveAtToSpreeProducts < ActiveRecord::Migration[5.2]
+ def change
+ add_column :spree_products, :status, :string, null: false, default: 'draft'
+ add_index :spree_products, :status
+ add_index :spree_products, %i[status deleted_at]
+ end
+end
diff --git a/server/db/migrate/20260317145983_add_internal_note_to_spree_orders.spree.rb b/server/db/migrate/20260317145983_add_internal_note_to_spree_orders.spree.rb
new file mode 100644
index 0000000000..1efb621e47
--- /dev/null
+++ b/server/db/migrate/20260317145983_add_internal_note_to_spree_orders.spree.rb
@@ -0,0 +1,6 @@
+# This migration comes from spree (originally 20220106230929)
+class AddInternalNoteToSpreeOrders < ActiveRecord::Migration[5.2]
+ def change
+ add_column :spree_orders, :internal_note, :text
+ end
+end
diff --git a/server/db/migrate/20260317145984_create_payment_sources.spree.rb b/server/db/migrate/20260317145984_create_payment_sources.spree.rb
new file mode 100644
index 0000000000..5b7322b409
--- /dev/null
+++ b/server/db/migrate/20260317145984_create_payment_sources.spree.rb
@@ -0,0 +1,23 @@
+# This migration comes from spree (originally 20220113052823)
+class CreatePaymentSources < ActiveRecord::Migration[5.2]
+ def change
+ create_table :spree_payment_sources do |t|
+ t.string :gateway_payment_profile_id
+ t.string :type, index: true
+
+ t.references :payment_method, index: true, foreign_key: { to_table: :spree_payment_methods }
+ t.references :user, index: true, foreign_key: { to_table: :spree_users }
+
+ if t.respond_to? :jsonb
+ t.jsonb :public_metadata
+ t.jsonb :private_metadata
+ else
+ t.json :public_metadata
+ t.json :private_metadata
+ end
+
+ t.index [:type, :gateway_payment_profile_id], unique: true, name: 'index_payment_sources_on_type_and_gateway_payment_profile_id'
+ t.timestamps
+ end
+ end
+end
diff --git a/server/db/migrate/20260317145985_add_make_active_at_to_spree_products.spree.rb b/server/db/migrate/20260317145985_add_make_active_at_to_spree_products.spree.rb
new file mode 100644
index 0000000000..c841893913
--- /dev/null
+++ b/server/db/migrate/20260317145985_add_make_active_at_to_spree_products.spree.rb
@@ -0,0 +1,18 @@
+# This migration comes from spree (originally 20220117100333)
+class AddMakeActiveAtToSpreeProducts < ActiveRecord::Migration[5.2]
+ def change
+ add_column :spree_products, :make_active_at, :datetime
+ add_index :spree_products, :make_active_at
+
+ Spree::Product.
+ where('discontinue_on IS NULL or discontinue_on > ?', Time.current).
+ where('available_on <= ?', Time.current).
+ where(status: 'draft').
+ update_all(status: 'active', updated_at: Time.current)
+
+ Spree::Product.
+ where('discontinue_on <= ?', Time.current).
+ where.not(status: 'archived').
+ update_all(status: 'archived', updated_at: Time.current)
+ end
+end
diff --git a/server/db/migrate/20260317145986_add_metadata_to_spree_tax_rates.spree.rb b/server/db/migrate/20260317145986_add_metadata_to_spree_tax_rates.spree.rb
new file mode 100644
index 0000000000..eed16c0d83
--- /dev/null
+++ b/server/db/migrate/20260317145986_add_metadata_to_spree_tax_rates.spree.rb
@@ -0,0 +1,14 @@
+# This migration comes from spree (originally 20220120092821)
+class AddMetadataToSpreeTaxRates < ActiveRecord::Migration[5.2]
+ def change
+ change_table :spree_tax_rates do |t|
+ if t.respond_to? :jsonb
+ add_column :spree_tax_rates, :public_metadata, :jsonb
+ add_column :spree_tax_rates, :private_metadata, :jsonb
+ else
+ add_column :spree_tax_rates, :public_metadata, :json
+ add_column :spree_tax_rates, :private_metadata, :json
+ end
+ end
+ end
+end
diff --git a/server/db/migrate/20260317145987_add_first_name_and_last_name_to_spree_users.spree.rb b/server/db/migrate/20260317145987_add_first_name_and_last_name_to_spree_users.spree.rb
new file mode 100644
index 0000000000..33151ad2a3
--- /dev/null
+++ b/server/db/migrate/20260317145987_add_first_name_and_last_name_to_spree_users.spree.rb
@@ -0,0 +1,10 @@
+# This migration comes from spree (originally 20220201103922)
+class AddFirstNameAndLastNameToSpreeUsers < ActiveRecord::Migration[5.2]
+ def change
+ if Spree.user_class.present?
+ users_table_name = Spree.user_class.table_name
+ add_column users_table_name, :first_name, :string unless column_exists?(users_table_name, :first_name)
+ add_column users_table_name, :last_name, :string unless column_exists?(users_table_name, :last_name)
+ end
+ end
+end
diff --git a/server/db/migrate/20260317145988_add_barcode_to_spree_variants.spree.rb b/server/db/migrate/20260317145988_add_barcode_to_spree_variants.spree.rb
new file mode 100644
index 0000000000..ab7c464795
--- /dev/null
+++ b/server/db/migrate/20260317145988_add_barcode_to_spree_variants.spree.rb
@@ -0,0 +1,7 @@
+# This migration comes from spree (originally 20220222083546)
+class AddBarcodeToSpreeVariants < ActiveRecord::Migration[5.2]
+ def change
+ add_column :spree_variants, :barcode, :string
+ add_index :spree_variants, :barcode
+ end
+end
diff --git a/server/db/migrate/20260317145989_add_metadata_to_spree_stock_items.spree.rb b/server/db/migrate/20260317145989_add_metadata_to_spree_stock_items.spree.rb
new file mode 100644
index 0000000000..3a6c6507c9
--- /dev/null
+++ b/server/db/migrate/20260317145989_add_metadata_to_spree_stock_items.spree.rb
@@ -0,0 +1,14 @@
+# This migration comes from spree (originally 20220613133029)
+class AddMetadataToSpreeStockItems < ActiveRecord::Migration[5.2]
+ def change
+ change_table :spree_stock_items do |t|
+ if t.respond_to? :jsonb
+ add_column :spree_stock_items, :public_metadata, :jsonb
+ add_column :spree_stock_items, :private_metadata, :jsonb
+ else
+ add_column :spree_stock_items, :public_metadata, :json
+ add_column :spree_stock_items, :private_metadata, :json
+ end
+ end
+ end
+end
diff --git a/server/db/migrate/20260317145990_create_product_name_and_description_translations_for_mobility_table_backend.spree.rb b/server/db/migrate/20260317145990_create_product_name_and_description_translations_for_mobility_table_backend.spree.rb
new file mode 100644
index 0000000000..da045d68b1
--- /dev/null
+++ b/server/db/migrate/20260317145990_create_product_name_and_description_translations_for_mobility_table_backend.spree.rb
@@ -0,0 +1,28 @@
+# This migration comes from spree (originally 20220706112554)
+class CreateProductNameAndDescriptionTranslationsForMobilityTableBackend < ActiveRecord::Migration[6.1]
+ def change
+ # create translation table only if spree_globalize has not already created it
+ if ActiveRecord::Base.connection.table_exists? 'spree_product_translations'
+ # manually check for index since Rails if_exists does not always work correctly
+ if ActiveRecord::Migration.connection.index_exists?(:spree_product_translations, :spree_product_id)
+ remove_index :spree_product_translations, name: "index_spree_product_translations_on_spree_product_id", if_exists: true
+ end
+ else
+ create_table :spree_product_translations do |t|
+
+ # Translated attribute(s)
+ t.string :name
+ t.text :description
+
+ t.string :locale, null: false
+ t.references :spree_product, null: false, foreign_key: true, index: false
+
+ t.timestamps null: false
+ end
+
+ add_index :spree_product_translations, :locale, name: :index_spree_product_translations_on_locale
+ end
+
+ add_index :spree_product_translations, [:spree_product_id, :locale], name: :unique_product_id_per_locale, unique: true
+ end
+end
diff --git a/server/db/migrate/20260317145991_create_spree_product_translations_for_mobility.spree.rb b/server/db/migrate/20260317145991_create_spree_product_translations_for_mobility.spree.rb
new file mode 100644
index 0000000000..d6de3a34e6
--- /dev/null
+++ b/server/db/migrate/20260317145991_create_spree_product_translations_for_mobility.spree.rb
@@ -0,0 +1,8 @@
+# This migration comes from spree (originally 20220715083542)
+class CreateSpreeProductTranslationsForMobility < ActiveRecord::Migration[6.1]
+ def change
+ add_column :spree_product_translations, :meta_description, :text, if_not_exists: true
+ add_column :spree_product_translations, :meta_keywords, :string, if_not_exists: true
+ add_column :spree_product_translations, :meta_title, :string, if_not_exists: true
+ end
+end
diff --git a/server/db/migrate/20260317145992_create_spree_taxon_name_and_description_translations_for_mobility_table_backend.spree.rb b/server/db/migrate/20260317145992_create_spree_taxon_name_and_description_translations_for_mobility_table_backend.spree.rb
new file mode 100644
index 0000000000..ef48a1d6b8
--- /dev/null
+++ b/server/db/migrate/20260317145992_create_spree_taxon_name_and_description_translations_for_mobility_table_backend.spree.rb
@@ -0,0 +1,28 @@
+# This migration comes from spree (originally 20220718100743)
+class CreateSpreeTaxonNameAndDescriptionTranslationsForMobilityTableBackend < ActiveRecord::Migration[6.1]
+ def change
+ # create translation table only if spree_globalize has not already created it
+ if ActiveRecord::Base.connection.table_exists? 'spree_taxon_translations'
+ # manually check for index since Rails if_exists does not always work correctly
+ if ActiveRecord::Migration.connection.index_exists?(:spree_taxon_translations, :spree_taxon_id)
+ # replacing this with index on spree_taxon_id and locale
+ remove_index :spree_taxon_translations, name: "index_spree_taxon_translations_on_spree_taxon_id", if_exists: true
+ end
+ else
+ create_table :spree_taxon_translations do |t|
+ # Translated attribute(s)
+ t.string :name
+ t.text :description
+
+ t.string :locale, null: false
+ t.references :spree_taxon, null: false, foreign_key: true, index: false
+
+ t.timestamps null: false
+ end
+
+ add_index :spree_taxon_translations, :locale, name: :index_spree_taxon_translations_on_locale
+ end
+
+ add_index :spree_taxon_translations, [:spree_taxon_id, :locale], name: :index_spree_taxon_translations_on_spree_taxon_id_and_locale, unique: true
+ end
+end
diff --git a/server/db/migrate/20260317145993_add_locale_to_friendly_id_slugs.spree.rb b/server/db/migrate/20260317145993_add_locale_to_friendly_id_slugs.spree.rb
new file mode 100644
index 0000000000..fad7ed6def
--- /dev/null
+++ b/server/db/migrate/20260317145993_add_locale_to_friendly_id_slugs.spree.rb
@@ -0,0 +1,12 @@
+# This migration comes from spree (originally 20220802070609)
+class AddLocaleToFriendlyIdSlugs < ActiveRecord::Migration[6.1]
+ def change
+ add_column :friendly_id_slugs, :locale, :string, null: :false, after: :scope
+
+ remove_index :friendly_id_slugs, [:slug, :sluggable_type]
+ add_index :friendly_id_slugs, [:slug, :sluggable_type, :locale], length: { slug: 140, sluggable_type: 50, locale: 2 }
+ remove_index :friendly_id_slugs, [:slug, :sluggable_type, :scope]
+ add_index :friendly_id_slugs, [:slug, :sluggable_type, :scope, :locale], length: { slug: 70, sluggable_type: 50, scope: 70, locale: 2 }, unique: true, name: :index_friendly_id_slugs_unique
+ add_index :friendly_id_slugs, :locale
+ end
+end
diff --git a/server/db/migrate/20260317145994_create_spree_product_slug_translations_for_mobility_table_backend.spree.rb b/server/db/migrate/20260317145994_create_spree_product_slug_translations_for_mobility_table_backend.spree.rb
new file mode 100644
index 0000000000..ba7afce613
--- /dev/null
+++ b/server/db/migrate/20260317145994_create_spree_product_slug_translations_for_mobility_table_backend.spree.rb
@@ -0,0 +1,6 @@
+# This migration comes from spree (originally 20220802073225)
+class CreateSpreeProductSlugTranslationsForMobilityTableBackend < ActiveRecord::Migration[6.1]
+ def change
+ add_column :spree_product_translations, :slug, :string
+ end
+end
diff --git a/server/db/migrate/20260317145995_add_selected_locale_to_spree_users.spree.rb b/server/db/migrate/20260317145995_add_selected_locale_to_spree_users.spree.rb
new file mode 100644
index 0000000000..c97a24793b
--- /dev/null
+++ b/server/db/migrate/20260317145995_add_selected_locale_to_spree_users.spree.rb
@@ -0,0 +1,9 @@
+# This migration comes from spree (originally 20221215151408)
+class AddSelectedLocaleToSpreeUsers < ActiveRecord::Migration[6.1]
+ def change
+ if Spree.user_class.present?
+ users_table_name = Spree.user_class.table_name
+ add_column users_table_name, :selected_locale, :string unless column_exists?(users_table_name, :selected_locale)
+ end
+ end
+end
diff --git a/server/db/migrate/20260317145996_add_deleted_at_to_product_translations.spree.rb b/server/db/migrate/20260317145996_add_deleted_at_to_product_translations.spree.rb
new file mode 100644
index 0000000000..d1735264e9
--- /dev/null
+++ b/server/db/migrate/20260317145996_add_deleted_at_to_product_translations.spree.rb
@@ -0,0 +1,7 @@
+# This migration comes from spree (originally 20221219123957)
+class AddDeletedAtToProductTranslations < ActiveRecord::Migration[6.1]
+ def change
+ add_column :spree_product_translations, :deleted_at, :datetime
+ add_index :spree_product_translations, :deleted_at
+ end
+end
diff --git a/server/db/migrate/20260317145997_add_uniqueness_constraint_to_product_translations.spree.rb b/server/db/migrate/20260317145997_add_uniqueness_constraint_to_product_translations.spree.rb
new file mode 100644
index 0000000000..cce1f04493
--- /dev/null
+++ b/server/db/migrate/20260317145997_add_uniqueness_constraint_to_product_translations.spree.rb
@@ -0,0 +1,6 @@
+# This migration comes from spree (originally 20221220133432)
+class AddUniquenessConstraintToProductTranslations < ActiveRecord::Migration[6.1]
+ def change
+ add_index :spree_product_translations, [:locale, :slug], unique: true, name: 'unique_slug_per_locale'
+ end
+end
diff --git a/server/db/migrate/20260317145998_create_option_type_translations.spree.rb b/server/db/migrate/20260317145998_create_option_type_translations.spree.rb
new file mode 100644
index 0000000000..89c06ef74a
--- /dev/null
+++ b/server/db/migrate/20260317145998_create_option_type_translations.spree.rb
@@ -0,0 +1,26 @@
+# This migration comes from spree (originally 20230103144439)
+class CreateOptionTypeTranslations < ActiveRecord::Migration[6.1]
+ def change
+ if ActiveRecord::Base.connection.table_exists? 'spree_option_type_translations'
+ # manually check for index since Rails if_exists does not always work correctly
+ if ActiveRecord::Migration.connection.index_exists?(:spree_option_type_translations, :spree_option_type_id)
+ remove_index :spree_option_type_translations, name: "index_spree_option_type_translations_on_spree_option_type_id", if_exists: true
+ end
+ else
+ create_table :spree_option_type_translations do |t|
+
+ # Translated attribute(s)
+ t.string :presentation
+
+ t.string :locale, null: false
+ t.references :spree_option_type, null: false, foreign_key: true, index: false
+
+ t.timestamps
+ end
+
+ add_index :spree_option_type_translations, :locale, name: :index_spree_option_type_translations_on_locale
+ end
+
+ add_index :spree_option_type_translations, [:spree_option_type_id, :locale], name: :unique_option_type_id_per_locale, unique: true
+ end
+end
diff --git a/server/db/migrate/20260317145999_create_option_value_translations.spree.rb b/server/db/migrate/20260317145999_create_option_value_translations.spree.rb
new file mode 100644
index 0000000000..11fc495224
--- /dev/null
+++ b/server/db/migrate/20260317145999_create_option_value_translations.spree.rb
@@ -0,0 +1,26 @@
+# This migration comes from spree (originally 20230103151034)
+class CreateOptionValueTranslations < ActiveRecord::Migration[6.1]
+ def change
+ if ActiveRecord::Base.connection.table_exists? 'spree_option_value_translations'
+ # manually check for index since Rails if_exists does not always work correctly
+ if ActiveRecord::Migration.connection.index_exists?(:spree_option_value_translations, :spree_option_value_id)
+ remove_index :spree_option_value_translations, column: :spree_option_value_id, if_exists: true
+ end
+ else
+ create_table :spree_option_value_translations do |t|
+
+ # Translated attribute(s)
+ t.string :presentation
+
+ t.string :locale, null: false
+ t.references :spree_option_value, null: false, foreign_key: true, index: false
+
+ t.timestamps
+ end
+
+ add_index :spree_option_value_translations, :locale, name: :index_spree_option_value_translations_on_locale
+ end
+
+ add_index :spree_option_value_translations, [:spree_option_value_id, :locale], name: :unique_option_value_id_per_locale, unique: true
+ end
+end
diff --git a/server/db/migrate/20260317146000_backfill_friendly_id_slug_locale.spree.rb b/server/db/migrate/20260317146000_backfill_friendly_id_slug_locale.spree.rb
new file mode 100644
index 0000000000..dcf2e88a11
--- /dev/null
+++ b/server/db/migrate/20260317146000_backfill_friendly_id_slug_locale.spree.rb
@@ -0,0 +1,12 @@
+# This migration comes from spree (originally 20230110142344)
+class BackfillFriendlyIdSlugLocale < ActiveRecord::Migration[6.1]
+ def up
+ if Spree::Store.default.present? && Spree::Store.default.default_locale.present?
+ FriendlyId::Slug.unscoped.update_all(locale: Spree::Store.default.default_locale)
+ end
+ end
+
+ def down
+ FriendlyId::Slug.unscoped.update_all(locale: nil)
+ end
+end
diff --git a/server/db/migrate/20260317146001_add_additional_taxon_translation_fields.spree.rb b/server/db/migrate/20260317146001_add_additional_taxon_translation_fields.spree.rb
new file mode 100644
index 0000000000..4d298360b0
--- /dev/null
+++ b/server/db/migrate/20260317146001_add_additional_taxon_translation_fields.spree.rb
@@ -0,0 +1,9 @@
+# This migration comes from spree (originally 20230111121534)
+class AddAdditionalTaxonTranslationFields < ActiveRecord::Migration[6.1]
+ def change
+ add_column :spree_taxon_translations, :meta_title, :string, if_not_exists: true
+ add_column :spree_taxon_translations, :meta_description, :string, if_not_exists: true
+ add_column :spree_taxon_translations, :meta_keywords, :string, if_not_exists: true
+ add_column :spree_taxon_translations, :permalink, :string, if_not_exists: true
+ end
+end
diff --git a/server/db/migrate/20260317146002_create_taxonomy_translations.spree.rb b/server/db/migrate/20260317146002_create_taxonomy_translations.spree.rb
new file mode 100644
index 0000000000..c58202d745
--- /dev/null
+++ b/server/db/migrate/20260317146002_create_taxonomy_translations.spree.rb
@@ -0,0 +1,25 @@
+# This migration comes from spree (originally 20230117115531)
+class CreateTaxonomyTranslations < ActiveRecord::Migration[6.1]
+ def change
+ if ActiveRecord::Base.connection.table_exists?('spree_taxonomy_translations')
+ # manually check for index since Rails if_exists does not always work correctly
+ if ActiveRecord::Migration.connection.index_exists?(:spree_taxonomy_translations, :spree_taxonomy_id)
+ remove_index :spree_taxonomy_translations, column: :spree_taxonomy_id, if_exists: true
+ end
+ else
+ create_table :spree_taxonomy_translations do |t|
+ # Translated attribute(s)
+ t.string :name
+
+ t.string :locale, null: false
+ t.references :spree_taxonomy, null: false, foreign_key: true, index: false
+
+ t.timestamps null: false
+ end
+
+ add_index :spree_taxonomy_translations, :locale, name: :index_spree_taxonomy_translations_on_locale
+ end
+
+ add_index :spree_taxonomy_translations, [:spree_taxonomy_id, :locale], name: :index_spree_taxonomy_translations_on_spree_taxonomy_id_locale, unique: true
+ end
+end
diff --git a/server/db/migrate/20260317146003_create_store_translations.spree.rb b/server/db/migrate/20260317146003_create_store_translations.spree.rb
new file mode 100644
index 0000000000..fbb3a540bd
--- /dev/null
+++ b/server/db/migrate/20260317146003_create_store_translations.spree.rb
@@ -0,0 +1,51 @@
+# This migration comes from spree (originally 20230210142732)
+class CreateStoreTranslations < ActiveRecord::Migration[6.1]
+ def change
+ if ActiveRecord::Base.connection.table_exists?('spree_store_translations')
+ add_new_translation_columns_to_globalize_table
+ else
+ create_table :spree_store_translations do |t|
+ # Translated attribute(s)
+ t.string :name
+ t.text :meta_description
+ t.text :meta_keywords
+ t.string :seo_title
+ t.string :facebook
+ t.string :twitter
+ t.string :instagram
+ t.string :customer_support_email
+ t.text :description
+ t.text :address
+ t.string :contact_phone
+ t.string :new_order_notifications_email
+
+ t.string :locale, null: false
+ t.references :spree_store, null: false, foreign_key: true, index: false
+
+ t.timestamps null: false
+ end
+
+ add_index :spree_store_translations, :locale, name: :index_spree_store_translations_on_locale
+ end
+
+ add_index :spree_store_translations, [:spree_store_id, :locale], name: :index_spree_store_translations_on_spree_store_id_locale, unique: true
+ end
+
+ private
+
+ def add_new_translation_columns_to_globalize_table
+ # manually check for index since Rails if_exists does not always work correctly
+ if ActiveRecord::Migration.connection.index_exists?(:spree_store_translations, :spree_store_id)
+ remove_index :spree_store_translations, column: :spree_store_id, if_exists: true
+ end
+
+ add_column :spree_store_translations, :facebook, :string
+ add_column :spree_store_translations, :twitter, :string
+ add_column :spree_store_translations, :instagram, :string
+ add_column :spree_store_translations, :customer_support_email, :string
+ add_column :spree_store_translations, :description, :text
+ add_column :spree_store_translations, :address, :text
+ add_column :spree_store_translations, :contact_phone, :string
+ add_column :spree_store_translations, :new_order_notifications_email, :string
+ end
+end
diff --git a/server/db/migrate/20260317146004_add_deleted_at_to_store_translations.spree.rb b/server/db/migrate/20260317146004_add_deleted_at_to_store_translations.spree.rb
new file mode 100644
index 0000000000..975021165d
--- /dev/null
+++ b/server/db/migrate/20260317146004_add_deleted_at_to_store_translations.spree.rb
@@ -0,0 +1,7 @@
+# This migration comes from spree (originally 20230210230434)
+class AddDeletedAtToStoreTranslations < ActiveRecord::Migration[6.1]
+ def change
+ add_column :spree_store_translations, :deleted_at, :datetime
+ add_index :spree_store_translations, :deleted_at
+ end
+end
diff --git a/server/db/migrate/20260317146005_fix_spree_stock_item_unique_index.spree.rb b/server/db/migrate/20260317146005_fix_spree_stock_item_unique_index.spree.rb
new file mode 100644
index 0000000000..9bd845bc6c
--- /dev/null
+++ b/server/db/migrate/20260317146005_fix_spree_stock_item_unique_index.spree.rb
@@ -0,0 +1,36 @@
+# This migration comes from spree (originally 20240303174340)
+class FixSpreeStockItemUniqueIndex < ActiveRecord::Migration[6.1]
+ def change
+ remove_index :spree_stock_items, name: 'stock_item_by_loc_var_id_deleted_at' if index_exists?(:spree_stock_items, [:stock_location_id, :variant_id], name: 'stock_item_by_loc_var_id_deleted_at')
+
+ unless index_exists?(:spree_stock_items, ['variant_id', 'stock_location_id'], name: 'index_spree_stock_items_unique_without_deleted_at')
+ # MySQL doesn't support partial indexes
+ if ActiveRecord::Base.connection.adapter_name == 'Mysql2'
+ reversible do |dir|
+ dir.up do
+ execute <<-SQL
+ CREATE UNIQUE INDEX index_spree_stock_items_unique_without_deleted_at
+ ON spree_stock_items(
+ stock_location_id,
+ variant_id,
+ (COALESCE(deleted_at, CAST('1970-01-01' AS DATETIME)))
+ );
+ SQL
+ end
+
+ dir.down do
+ remove_index :spree_stock_items, name: :index_spree_stock_items_unique_without_deleted_at
+ end
+ end
+ else
+ add_index(
+ :spree_stock_items,
+ ['variant_id', 'stock_location_id'],
+ name: 'index_spree_stock_items_unique_without_deleted_at',
+ unique: true,
+ where: 'deleted_at IS NULL',
+ )
+ end
+ end
+ end
+end
diff --git a/server/db/migrate/20260317146006_add_weight_and_dimension_units_to_spree_variants.spree.rb b/server/db/migrate/20260317146006_add_weight_and_dimension_units_to_spree_variants.spree.rb
new file mode 100644
index 0000000000..e7e405bf42
--- /dev/null
+++ b/server/db/migrate/20260317146006_add_weight_and_dimension_units_to_spree_variants.spree.rb
@@ -0,0 +1,7 @@
+# This migration comes from spree (originally 20240514105216)
+class AddWeightAndDimensionUnitsToSpreeVariants < ActiveRecord::Migration[6.1]
+ def change
+ add_column :spree_variants, :weight_unit, :string, if_not_exists: true
+ add_column :spree_variants, :dimensions_unit, :string, if_not_exists: true
+ end
+end
diff --git a/server/db/migrate/20260317146007_add_deleted_at_to_spree_stock_locations.spree.rb b/server/db/migrate/20260317146007_add_deleted_at_to_spree_stock_locations.spree.rb
new file mode 100644
index 0000000000..d353f3dff7
--- /dev/null
+++ b/server/db/migrate/20260317146007_add_deleted_at_to_spree_stock_locations.spree.rb
@@ -0,0 +1,7 @@
+# This migration comes from spree (originally 20240623172111)
+class AddDeletedAtToSpreeStockLocations < ActiveRecord::Migration[6.1]
+ def change
+ add_column :spree_stock_locations, :deleted_at, :datetime, if_not_exists: true
+ add_index :spree_stock_locations, :deleted_at, if_not_exists: true
+ end
+end
diff --git a/server/db/migrate/20260317146008_add_refunder_to_spree_refunds.spree.rb b/server/db/migrate/20260317146008_add_refunder_to_spree_refunds.spree.rb
new file mode 100644
index 0000000000..2ac2b5d4f5
--- /dev/null
+++ b/server/db/migrate/20260317146008_add_refunder_to_spree_refunds.spree.rb
@@ -0,0 +1,7 @@
+# This migration comes from spree (originally 20240725124530)
+class AddRefunderToSpreeRefunds < ActiveRecord::Migration[6.1]
+ def change
+ add_column :spree_refunds, :refunder_id, :bigint, if_not_exists: true
+ add_index :spree_refunds, :refunder_id, if_not_exists: true
+ end
+end
diff --git a/server/db/migrate/20260317146009_add_pretty_name_to_spree_taxons.spree.rb b/server/db/migrate/20260317146009_add_pretty_name_to_spree_taxons.spree.rb
new file mode 100644
index 0000000000..72b25b9712
--- /dev/null
+++ b/server/db/migrate/20260317146009_add_pretty_name_to_spree_taxons.spree.rb
@@ -0,0 +1,10 @@
+# This migration comes from spree (originally 20240822163534)
+class AddPrettyNameToSpreeTaxons < ActiveRecord::Migration[6.1]
+ def change
+ add_column :spree_taxons, :pretty_name, :string, null: true, if_not_exists: true
+ add_index :spree_taxons, :pretty_name, if_not_exists: true
+
+ add_column :spree_taxon_translations, :pretty_name, :string, null: true, if_not_exists: true
+ add_index :spree_taxon_translations, :pretty_name, if_not_exists: true
+ end
+end
diff --git a/server/db/migrate/20260317146010_change_default_value_of_spree_option_types_filterable.spree.rb b/server/db/migrate/20260317146010_change_default_value_of_spree_option_types_filterable.spree.rb
new file mode 100644
index 0000000000..6942c2b211
--- /dev/null
+++ b/server/db/migrate/20260317146010_change_default_value_of_spree_option_types_filterable.spree.rb
@@ -0,0 +1,6 @@
+# This migration comes from spree (originally 20240913143518)
+class ChangeDefaultValueOfSpreeOptionTypesFilterable < ActiveRecord::Migration[6.1]
+ def change
+ change_column_default :spree_option_types, :filterable, from: false, to: true
+ end
+end
diff --git a/server/db/migrate/20260317146011_create_spree_coupon_codes.spree.rb b/server/db/migrate/20260317146011_create_spree_coupon_codes.spree.rb
new file mode 100644
index 0000000000..68f20dafcb
--- /dev/null
+++ b/server/db/migrate/20260317146011_create_spree_coupon_codes.spree.rb
@@ -0,0 +1,16 @@
+# This migration comes from spree (originally 20241004181911)
+class CreateSpreeCouponCodes < ActiveRecord::Migration[6.1]
+ def change
+ return if table_exists?(:spree_coupon_codes)
+
+ create_table :spree_coupon_codes do |t|
+ t.string :code, index: { unique: true }
+ t.references :promotion, index: true
+ t.references :order, index: true
+ t.integer :state, default: 0, null: false, index: true
+ t.datetime :deleted_at, index: true
+
+ t.timestamps
+ end
+ end
+end
diff --git a/server/db/migrate/20260317146012_add_multi_code_to_spree_promotions.spree.rb b/server/db/migrate/20260317146012_add_multi_code_to_spree_promotions.spree.rb
new file mode 100644
index 0000000000..9c631d9aad
--- /dev/null
+++ b/server/db/migrate/20260317146012_add_multi_code_to_spree_promotions.spree.rb
@@ -0,0 +1,17 @@
+# This migration comes from spree (originally 20241005093437)
+class AddMultiCodeToSpreePromotions < ActiveRecord::Migration[6.1]
+ def change
+ add_column :spree_promotions, :code_prefix, :string, if_not_exists: true
+ add_column :spree_promotions, :number_of_codes, :integer, if_not_exists: true
+ add_column :spree_promotions, :kind, :integer, default: 0, if_not_exists: true
+ add_column :spree_promotions, :multi_codes, :boolean, default: false, if_not_exists: true
+
+ add_index :spree_promotions, :kind, if_not_exists: true
+
+ unless Rails.env.test?
+ Spree::Promotion.reset_column_information
+ # set all promotions without a code to automatic
+ Spree::Promotion.where(code: [nil, '']).update_all(kind: 1)
+ end
+ end
+end
diff --git a/server/db/migrate/20260317146013_translate_rich_texts.spree.rb b/server/db/migrate/20260317146013_translate_rich_texts.spree.rb
new file mode 100644
index 0000000000..5f4399bc2a
--- /dev/null
+++ b/server/db/migrate/20260317146013_translate_rich_texts.spree.rb
@@ -0,0 +1,18 @@
+# This migration comes from spree (originally 20241014140140)
+class TranslateRichTexts < ActiveRecord::Migration[6.1]
+ def change
+ if table_exists?(:action_text_rich_texts)
+ add_column :action_text_rich_texts, :locale, :string, null: false
+
+ remove_index :action_text_rich_texts,
+ column: [:record_type, :record_id, :name],
+ name: :index_action_text_rich_texts_uniqueness,
+ unique: true
+
+ add_index :action_text_rich_texts,
+ [:record_type, :record_id, :name, :locale],
+ name: :index_action_text_rich_texts_uniqueness,
+ unique: true
+ end
+ end
+end
diff --git a/server/db/migrate/20260317146014_create_spree_exports.spree.rb b/server/db/migrate/20260317146014_create_spree_exports.spree.rb
new file mode 100644
index 0000000000..cca54a9544
--- /dev/null
+++ b/server/db/migrate/20260317146014_create_spree_exports.spree.rb
@@ -0,0 +1,24 @@
+# This migration comes from spree (originally 20241030134309)
+class CreateSpreeExports < ActiveRecord::Migration[6.1]
+ def change
+ return if table_exists?(:spree_exports)
+
+ create_table :spree_exports do |t|
+ t.references :user
+ t.references :store, null: false
+
+ t.string :number, limit: 32, null: false, index: { unique: true }
+ t.string :type, null: false
+
+ if t.respond_to? :jsonb
+ t.jsonb :search_params
+ else
+ t.json :search_params
+ end
+
+ t.integer :format, index: true, null: false
+
+ t.timestamps
+ end
+ end
+end
diff --git a/server/db/migrate/20260317146015_migrate_spree_promotion_rules_option_value_eligible_values.spree.rb b/server/db/migrate/20260317146015_migrate_spree_promotion_rules_option_value_eligible_values.spree.rb
new file mode 100644
index 0000000000..e01026f620
--- /dev/null
+++ b/server/db/migrate/20260317146015_migrate_spree_promotion_rules_option_value_eligible_values.spree.rb
@@ -0,0 +1,17 @@
+# This migration comes from spree (originally 20241104083457)
+class MigrateSpreePromotionRulesOptionValueEligibleValues < ActiveRecord::Migration[6.1]
+ def change
+ Spree::Promotion::Rules::OptionValue.find_each do |option_value|
+ new_eligible_values = option_value.preferred_eligible_values.flat_map do |product_id, option_value_ids|
+ value_ids = option_value_ids.is_a?(String) ? option_value_ids.split(',') : option_value_ids
+
+ Spree::OptionValueVariant.
+ joins(:variant).
+ where(option_value_id: value_ids, "#{Spree::Variant.table_name}.product_id" => product_id).
+ pluck(:id)
+ end
+
+ option_value.update!(preferred_eligible_values: new_eligible_values)
+ end
+ end
+end
diff --git a/server/db/migrate/20260317146016_add_estimated_transit_fields_to_spree_shipping_methods.spree.rb b/server/db/migrate/20260317146016_add_estimated_transit_fields_to_spree_shipping_methods.spree.rb
new file mode 100644
index 0000000000..88e1c952b1
--- /dev/null
+++ b/server/db/migrate/20260317146016_add_estimated_transit_fields_to_spree_shipping_methods.spree.rb
@@ -0,0 +1,7 @@
+# This migration comes from spree (originally 20241123110646)
+class AddEstimatedTransitFieldsToSpreeShippingMethods < ActiveRecord::Migration[6.1]
+ def change
+ add_column :spree_shipping_methods, :estimated_transit_business_days_min, :integer
+ add_column :spree_shipping_methods, :estimated_transit_business_days_max, :integer
+ end
+end
diff --git a/server/db/migrate/20260317146017_create_spree_taxon_rules.spree.rb b/server/db/migrate/20260317146017_create_spree_taxon_rules.spree.rb
new file mode 100644
index 0000000000..1ed36d6364
--- /dev/null
+++ b/server/db/migrate/20260317146017_create_spree_taxon_rules.spree.rb
@@ -0,0 +1,14 @@
+# This migration comes from spree (originally 20241127193411)
+class CreateSpreeTaxonRules < ActiveRecord::Migration[6.1]
+ def change
+ create_table :spree_taxon_rules do |t|
+ t.belongs_to :taxon, null: false, index: true
+
+ t.string :type, null: false
+ t.string :value, null: false
+ t.string :match_policy, null: false, default: 'is_equal_to'
+
+ t.timestamps
+ end
+ end
+end
diff --git a/server/db/migrate/20260317146018_add_rules_match_policy_and_sort_order_to_spree_taxons.spree.rb b/server/db/migrate/20260317146018_add_rules_match_policy_and_sort_order_to_spree_taxons.spree.rb
new file mode 100644
index 0000000000..11a8d430f9
--- /dev/null
+++ b/server/db/migrate/20260317146018_add_rules_match_policy_and_sort_order_to_spree_taxons.spree.rb
@@ -0,0 +1,7 @@
+# This migration comes from spree (originally 20241127223627)
+class AddRulesMatchPolicyAndSortOrderToSpreeTaxons < ActiveRecord::Migration[6.1]
+ def change
+ add_column :spree_taxons, :rules_match_policy, :string, default: 'all', null: false
+ add_column :spree_taxons, :sort_order, :string, default: 'manual', null: false
+ end
+end
diff --git a/server/db/migrate/20260317146019_add_automatic_to_spree_taxons.spree.rb b/server/db/migrate/20260317146019_add_automatic_to_spree_taxons.spree.rb
new file mode 100644
index 0000000000..0a0050f4ed
--- /dev/null
+++ b/server/db/migrate/20260317146019_add_automatic_to_spree_taxons.spree.rb
@@ -0,0 +1,6 @@
+# This migration comes from spree (originally 20241128103947)
+class AddAutomaticToSpreeTaxons < ActiveRecord::Migration[6.1]
+ def change
+ add_column :spree_taxons, :automatic, :boolean, default: false, null: false
+ end
+end
diff --git a/server/db/migrate/20260317146020_add_gateway_customer_profile_id_to_spree_payment_sources.spree.rb b/server/db/migrate/20260317146020_add_gateway_customer_profile_id_to_spree_payment_sources.spree.rb
new file mode 100644
index 0000000000..373fb165ec
--- /dev/null
+++ b/server/db/migrate/20260317146020_add_gateway_customer_profile_id_to_spree_payment_sources.spree.rb
@@ -0,0 +1,6 @@
+# This migration comes from spree (originally 20241218183905)
+class AddGatewayCustomerProfileIdToSpreePaymentSources < ActiveRecord::Migration[6.1]
+ def change
+ add_column :spree_payment_sources, :gateway_customer_profile_id, :string
+ end
+end
diff --git a/server/db/migrate/20260317146021_add_accept_marketing_and_signup_for_an_account_to_spree_orders.spree.rb b/server/db/migrate/20260317146021_add_accept_marketing_and_signup_for_an_account_to_spree_orders.spree.rb
new file mode 100644
index 0000000000..d085d9a340
--- /dev/null
+++ b/server/db/migrate/20260317146021_add_accept_marketing_and_signup_for_an_account_to_spree_orders.spree.rb
@@ -0,0 +1,7 @@
+# This migration comes from spree (originally 20250107220432)
+class AddAcceptMarketingAndSignupForAnAccountToSpreeOrders < ActiveRecord::Migration[6.1]
+ def change
+ add_column :spree_orders, :accept_marketing, :boolean, default: false, if_not_exists: true
+ add_column :spree_orders, :signup_for_an_account, :boolean, default: false, if_not_exists: true
+ end
+end
diff --git a/server/db/migrate/20260317146022_add_quick_checkout_to_spree_addresses.spree.rb b/server/db/migrate/20260317146022_add_quick_checkout_to_spree_addresses.spree.rb
new file mode 100644
index 0000000000..94a28aaaa1
--- /dev/null
+++ b/server/db/migrate/20260317146022_add_quick_checkout_to_spree_addresses.spree.rb
@@ -0,0 +1,7 @@
+# This migration comes from spree (originally 20250110171203)
+class AddQuickCheckoutToSpreeAddresses < ActiveRecord::Migration[6.1]
+ def change
+ add_column :spree_addresses, :quick_checkout, :boolean, default: false, if_not_exists: true
+ add_index :spree_addresses, :quick_checkout, if_not_exists: true
+ end
+end
diff --git a/server/db/migrate/20260317146023_add_preferences_to_spree_stores.spree.rb b/server/db/migrate/20260317146023_add_preferences_to_spree_stores.spree.rb
new file mode 100644
index 0000000000..3441373359
--- /dev/null
+++ b/server/db/migrate/20260317146023_add_preferences_to_spree_stores.spree.rb
@@ -0,0 +1,6 @@
+# This migration comes from spree (originally 20250113180019)
+class AddPreferencesToSpreeStores < ActiveRecord::Migration[6.1]
+ def change
+ add_column :spree_stores, :preferences, :text, if_not_exists: true
+ end
+end
diff --git a/server/db/migrate/20260317146024_add_metadata_to_spree_stores.spree.rb b/server/db/migrate/20260317146024_add_metadata_to_spree_stores.spree.rb
new file mode 100644
index 0000000000..3b1ec2bd14
--- /dev/null
+++ b/server/db/migrate/20260317146024_add_metadata_to_spree_stores.spree.rb
@@ -0,0 +1,14 @@
+# This migration comes from spree (originally 20250114193857)
+class AddMetadataToSpreeStores < ActiveRecord::Migration[6.1]
+ def change
+ change_table :spree_stores do |t|
+ if t.respond_to? :jsonb
+ add_column :spree_stores, :public_metadata, :jsonb
+ add_column :spree_stores, :private_metadata, :jsonb
+ else
+ add_column :spree_stores, :public_metadata, :json
+ add_column :spree_stores, :private_metadata, :json
+ end
+ end
+ end
+end
diff --git a/server/db/migrate/20260317146025_create_spree_custom_domains.spree.rb b/server/db/migrate/20260317146025_create_spree_custom_domains.spree.rb
new file mode 100644
index 0000000000..a0de0b25f6
--- /dev/null
+++ b/server/db/migrate/20260317146025_create_spree_custom_domains.spree.rb
@@ -0,0 +1,23 @@
+# This migration comes from spree (originally 20250119165904)
+class CreateSpreeCustomDomains < ActiveRecord::Migration[6.1]
+ def change
+ return if table_exists?(:spree_custom_domains)
+
+ create_table :spree_custom_domains do |t|
+ t.references :store, null: false, index: true
+ t.string :url, null: false, index: { unique: true }
+ t.boolean :status, default: false
+ t.boolean :default, default: false, null: false
+
+ if t.respond_to? :jsonb
+ t.jsonb :public_metadata
+ t.jsonb :private_metadata
+ else
+ t.json :public_metadata
+ t.json :private_metadata
+ end
+
+ t.timestamps
+ end
+ end
+end
diff --git a/server/db/migrate/20260317146026_add_default_locale_to_action_text_rich_texts.spree.rb b/server/db/migrate/20260317146026_add_default_locale_to_action_text_rich_texts.spree.rb
new file mode 100644
index 0000000000..03d02631da
--- /dev/null
+++ b/server/db/migrate/20260317146026_add_default_locale_to_action_text_rich_texts.spree.rb
@@ -0,0 +1,8 @@
+# This migration comes from spree (originally 20250120152208)
+class AddDefaultLocaleToActionTextRichTexts < ActiveRecord::Migration[6.1]
+ def change
+ if ActionText::RichText.column_defaults['locale'].nil?
+ change_column_default :action_text_rich_texts, :locale, from: nil, to: :en
+ end
+ end
+end
diff --git a/server/db/migrate/20260317146027_add_first_and_last_name_to_spree_admin_class.spree.rb b/server/db/migrate/20260317146027_add_first_and_last_name_to_spree_admin_class.spree.rb
new file mode 100644
index 0000000000..8cc1b67244
--- /dev/null
+++ b/server/db/migrate/20260317146027_add_first_and_last_name_to_spree_admin_class.spree.rb
@@ -0,0 +1,10 @@
+# This migration comes from spree (originally 20250122113708)
+class AddFirstAndLastNameToSpreeAdminClass < ActiveRecord::Migration[6.1]
+ def change
+ if Spree.admin_user_class.present?
+ admin_users_table_name = Spree.admin_user_class.table_name
+ add_column admin_users_table_name, :first_name, :string unless column_exists?(admin_users_table_name, :first_name)
+ add_column admin_users_table_name, :last_name, :string unless column_exists?(admin_users_table_name, :last_name)
+ end
+ end
+end
diff --git a/server/db/migrate/20260317146028_add_custom_code_fields_to_spree_store.spree.rb b/server/db/migrate/20260317146028_add_custom_code_fields_to_spree_store.spree.rb
new file mode 100644
index 0000000000..fc8f8d605e
--- /dev/null
+++ b/server/db/migrate/20260317146028_add_custom_code_fields_to_spree_store.spree.rb
@@ -0,0 +1,8 @@
+# This migration comes from spree (originally 20250123135358)
+class AddCustomCodeFieldsToSpreeStore < ActiveRecord::Migration[6.1]
+ def change
+ add_column :spree_stores, :storefront_custom_code_head, :text
+ add_column :spree_stores, :storefront_custom_code_body_start, :text
+ add_column :spree_stores, :storefront_custom_code_body_end, :text
+ end
+end
diff --git a/server/db/migrate/20260317146029_add_latitude_and_longitude_to_spree_addresses.spree.rb b/server/db/migrate/20260317146029_add_latitude_and_longitude_to_spree_addresses.spree.rb
new file mode 100644
index 0000000000..efa8671d64
--- /dev/null
+++ b/server/db/migrate/20260317146029_add_latitude_and_longitude_to_spree_addresses.spree.rb
@@ -0,0 +1,7 @@
+# This migration comes from spree (originally 20250127112758)
+class AddLatitudeAndLongitudeToSpreeAddresses < ActiveRecord::Migration[6.1]
+ def change
+ add_column :spree_addresses, :latitude, :decimal, if_not_exists: true
+ add_column :spree_addresses, :longitude, :decimal, if_not_exists: true
+ end
+end
diff --git a/server/db/migrate/20260317146030_add_phone_to_spree_users.spree.rb b/server/db/migrate/20260317146030_add_phone_to_spree_users.spree.rb
new file mode 100644
index 0000000000..4e549a96f3
--- /dev/null
+++ b/server/db/migrate/20260317146030_add_phone_to_spree_users.spree.rb
@@ -0,0 +1,6 @@
+# This migration comes from spree (originally 20250127151258)
+class AddPhoneToSpreeUsers < ActiveRecord::Migration[6.1]
+ def change
+ add_column Spree.user_class.table_name, :phone, :string, if_not_exists: true
+ end
+end
diff --git a/server/db/migrate/20260317146031_create_spree_reports.spree.rb b/server/db/migrate/20260317146031_create_spree_reports.spree.rb
new file mode 100644
index 0000000000..d4218ac260
--- /dev/null
+++ b/server/db/migrate/20260317146031_create_spree_reports.spree.rb
@@ -0,0 +1,14 @@
+# This migration comes from spree (originally 20250204162453)
+class CreateSpreeReports < ActiveRecord::Migration[6.1]
+ def change
+ create_table :spree_reports do |t|
+ t.references :store, null: false
+ t.references :user
+ t.string 'type'
+ t.string 'currency'
+ t.datetime 'date_from'
+ t.datetime 'date_to'
+ t.timestamps
+ end
+ end
+end
diff --git a/server/db/migrate/20260317146032_add_accepts_email_marketing_field_to_spree_users_table.spree.rb b/server/db/migrate/20260317146032_add_accepts_email_marketing_field_to_spree_users_table.spree.rb
new file mode 100644
index 0000000000..fd40e16ef3
--- /dev/null
+++ b/server/db/migrate/20260317146032_add_accepts_email_marketing_field_to_spree_users_table.spree.rb
@@ -0,0 +1,7 @@
+# This migration comes from spree (originally 20250207084000)
+class AddAcceptsEmailMarketingFieldToSpreeUsersTable < ActiveRecord::Migration[6.1]
+ def change
+ add_column Spree.user_class.table_name, :accepts_email_marketing, :boolean, default: false, null: false, if_not_exists: true
+ add_index Spree.user_class.table_name, :accepts_email_marketing, if_not_exists: true
+ end
+end
diff --git a/server/db/migrate/20260317146033_add_performed_by_to_spree_reimbursements.spree.rb b/server/db/migrate/20260317146033_add_performed_by_to_spree_reimbursements.spree.rb
new file mode 100644
index 0000000000..a172975f0c
--- /dev/null
+++ b/server/db/migrate/20260317146033_add_performed_by_to_spree_reimbursements.spree.rb
@@ -0,0 +1,6 @@
+# This migration comes from spree (originally 20250304115943)
+class AddPerformedByToSpreeReimbursements < ActiveRecord::Migration[6.1]
+ def change
+ add_reference :spree_reimbursements, :performed_by, index: true, null: true unless column_exists?(:spree_reimbursements, :performed_by_id)
+ end
+end
diff --git a/server/db/migrate/20260317146034_create_spree_gateway_customers.spree.rb b/server/db/migrate/20260317146034_create_spree_gateway_customers.spree.rb
new file mode 100644
index 0000000000..9a485f2845
--- /dev/null
+++ b/server/db/migrate/20260317146034_create_spree_gateway_customers.spree.rb
@@ -0,0 +1,19 @@
+# This migration comes from spree (originally 20250311105934)
+class CreateSpreeGatewayCustomers < ActiveRecord::Migration[7.2]
+ def change
+ create_table :spree_gateway_customers, if_not_exists: true do |t|
+ t.string :profile_id, null: false
+ t.bigint :payment_method_id, null: false
+ t.bigint :user_id, null: false
+
+ t.timestamps
+
+ t.index ['payment_method_id'], name: 'index_spree_gateway_customers_on_payment_method_id'
+ t.index ['user_id', 'payment_method_id'], name: 'index_spree_gateway_customers_on_user_id_and_payment_method_id', unique: true
+ t.index ['user_id'], name: 'index_spree_gateway_customers_on_user_id'
+ end
+
+ add_column :spree_credit_cards, :gateway_customer_id, :bigint, if_not_exists: true
+ add_index :spree_credit_cards, :gateway_customer_id, if_not_exists: true
+ end
+end
diff --git a/server/db/migrate/20260317146035_add_unique_index_on_promotion_rules_associations.spree.rb b/server/db/migrate/20260317146035_add_unique_index_on_promotion_rules_associations.spree.rb
new file mode 100644
index 0000000000..bb451c6fd3
--- /dev/null
+++ b/server/db/migrate/20260317146035_add_unique_index_on_promotion_rules_associations.spree.rb
@@ -0,0 +1,76 @@
+# This migration comes from spree (originally 20250312202705)
+class AddUniqueIndexOnPromotionRulesAssociations < ActiveRecord::Migration[7.2]
+ def change
+ if ActiveRecord::Base.connection.adapter_name == 'Mysql2'
+ # Remove duplicate product promotion rules
+ execute <<-SQL
+ DELETE FROM spree_product_promotion_rules
+ WHERE id NOT IN (
+ SELECT mid FROM (
+ SELECT MIN(id) AS mid
+ FROM spree_product_promotion_rules
+ GROUP BY product_id, promotion_rule_id
+ ) AS min_ids
+ );
+ SQL
+
+ # Remove duplicate taxon promotion rules
+ execute <<-SQL
+ DELETE FROM spree_promotion_rule_taxons
+ WHERE id NOT IN (
+ SELECT mid FROM (
+ SELECT MIN(id) AS mid
+ FROM spree_promotion_rule_taxons
+ GROUP BY taxon_id, promotion_rule_id
+ ) AS min_ids
+ );
+ SQL
+
+ # Remove duplicate user promotion rules
+ execute <<-SQL
+ DELETE FROM spree_promotion_rule_users
+ WHERE id NOT IN (
+ SELECT mid FROM (
+ SELECT MIN(id) AS mid
+ FROM spree_promotion_rule_users
+ GROUP BY user_id, promotion_rule_id
+ ) AS min_ids
+ );
+ SQL
+ else
+ # Remove duplicate product promotion rules
+ execute <<-SQL
+ DELETE FROM spree_product_promotion_rules
+ WHERE id NOT IN (
+ SELECT MIN(id)
+ FROM spree_product_promotion_rules
+ GROUP BY product_id, promotion_rule_id
+ );
+ SQL
+
+ # Remove duplicate taxon promotion rules
+ execute <<-SQL
+ DELETE FROM spree_promotion_rule_taxons
+ WHERE id NOT IN (
+ SELECT MIN(id)
+ FROM spree_promotion_rule_taxons
+ GROUP BY taxon_id, promotion_rule_id
+ );
+ SQL
+
+ # Remove duplicate user promotion rules
+ execute <<-SQL
+ DELETE FROM spree_promotion_rule_users
+ WHERE id NOT IN (
+ SELECT MIN(id)
+ FROM spree_promotion_rule_users
+ GROUP BY user_id, promotion_rule_id
+ );
+ SQL
+ end
+
+ add_index :spree_product_promotion_rules, [:product_id, :promotion_rule_id], unique: true
+ add_index :spree_promotion_rule_taxons, [:taxon_id, :promotion_rule_id], unique: true
+ add_index :spree_promotion_rule_users, [:user_id, :promotion_rule_id], unique: true
+ end
+end
diff --git a/server/db/migrate/20260317146036_add_user_type_to_spree_role_users.spree.rb b/server/db/migrate/20260317146036_add_user_type_to_spree_role_users.spree.rb
new file mode 100644
index 0000000000..3fbb624a86
--- /dev/null
+++ b/server/db/migrate/20260317146036_add_user_type_to_spree_role_users.spree.rb
@@ -0,0 +1,19 @@
+# This migration comes from spree (originally 20250313104226)
+class AddUserTypeToSpreeRoleUsers < ActiveRecord::Migration[6.1]
+ def up
+ unless column_exists?(:spree_role_users, :user_type)
+ add_column :spree_role_users, :user_type, :string
+ add_index :spree_role_users, :user_type
+
+ user_class_name = Spree.admin_user_class.to_s
+ Spree::RoleUser.where(user_type: nil).update_all(user_type: user_class_name)
+
+ change_column_null :spree_role_users, :user_type, false
+ end
+ end
+
+ def down
+ remove_index :spree_role_users, :user_type, if_exists: true
+ remove_column :spree_role_users, :user_type, if_exists: true
+ end
+end
diff --git a/server/db/migrate/20260317146037_add_unique_index_on_promotion_action_line_items.spree.rb b/server/db/migrate/20260317146037_add_unique_index_on_promotion_action_line_items.spree.rb
new file mode 100644
index 0000000000..fa3791d774
--- /dev/null
+++ b/server/db/migrate/20260317146037_add_unique_index_on_promotion_action_line_items.spree.rb
@@ -0,0 +1,30 @@
+# This migration comes from spree (originally 20250313175830)
+class AddUniqueIndexOnPromotionActionLineItems < ActiveRecord::Migration[7.2]
+ def change
+ if ActiveRecord::Base.connection.adapter_name == 'Mysql2'
+ # Remove duplicate promotion action line items
+ execute <<-SQL
+ DELETE FROM spree_promotion_action_line_items
+ WHERE id NOT IN (
+ SELECT mid FROM (
+ SELECT MIN(id) AS mid
+ FROM spree_promotion_action_line_items
+ GROUP BY promotion_action_id, variant_id
+ ) AS min_ids
+ );
+ SQL
+ else
+ # Remove duplicate promotion action line items
+ execute <<-SQL
+ DELETE FROM spree_promotion_action_line_items
+ WHERE id NOT IN (
+ SELECT MIN(id)
+ FROM spree_promotion_action_line_items
+ GROUP BY promotion_action_id, variant_id
+ );
+ SQL
+ end
+
+ add_index :spree_promotion_action_line_items, [:promotion_action_id, :variant_id], unique: true
+ end
+end
diff --git a/server/db/migrate/20260317146038_create_spree_taggings_and_spree_tags.spree.rb b/server/db/migrate/20260317146038_create_spree_taggings_and_spree_tags.spree.rb
new file mode 100644
index 0000000000..14a65431a6
--- /dev/null
+++ b/server/db/migrate/20260317146038_create_spree_taggings_and_spree_tags.spree.rb
@@ -0,0 +1,39 @@
+# This migration comes from spree (originally 20250314144210)
+class CreateSpreeTaggingsAndSpreeTags < ActiveRecord::Migration[7.2]
+ def change
+ create_table :spree_taggings do |t|
+ t.bigint "tag_id"
+ t.string "taggable_type"
+ t.bigint "taggable_id"
+ t.string "tagger_type"
+ t.bigint "tagger_id"
+ t.string "context", limit: 128
+ t.datetime "created_at", precision: nil
+ t.string "tenant", limit: 128
+ t.index ["context"], name: "index_spree_taggings_on_context"
+ t.index ["tag_id", "taggable_id", "taggable_type", "context", "tagger_id", "tagger_type"], name: "spree_taggings_idx", unique: true
+ t.index ["tag_id"], name: "index_spree_taggings_on_tag_id"
+ t.index ["taggable_id", "taggable_type", "context"], name: "spree_taggings_taggable_context_idx"
+ t.index ["taggable_id", "taggable_type", "tagger_id", "context"], name: "spree_taggings_idy"
+ t.index ["taggable_id"], name: "index_spree_taggings_on_taggable_id"
+ t.index ["taggable_type", "taggable_id"], name: "index_spree_taggings_on_taggable_type_and_taggable_id"
+ t.index ["taggable_type"], name: "index_spree_taggings_on_taggable_type"
+ t.index ["tagger_id", "tagger_type"], name: "index_spree_taggings_on_tagger_id_and_tagger_type"
+ t.index ["tagger_id"], name: "index_spree_taggings_on_tagger_id"
+ t.index ["tagger_type", "tagger_id"], name: "index_spree_taggings_on_tagger_type_and_tagger_id"
+ t.index ["tenant"], name: "index_spree_taggings_on_tenant"
+ end
+
+ create_table :spree_tags do |t|
+ t.string "name"
+ t.datetime "created_at", null: false
+ t.datetime "updated_at", null: false
+ t.integer "taggings_count", default: 0
+ t.index ["name"], name: "index_spree_tags_on_name", unique: true
+ end
+
+ if ActiveRecord::Base.connection.adapter_name == 'PostgreSQL'
+ add_index :spree_tags, 'lower(name) varchar_pattern_ops', name: 'index_spree_tags_on_lower_name'
+ end
+ end
+end
diff --git a/server/db/migrate/20260317146039_create_spree_integrations.spree.rb b/server/db/migrate/20260317146039_create_spree_integrations.spree.rb
new file mode 100644
index 0000000000..32933daf76
--- /dev/null
+++ b/server/db/migrate/20260317146039_create_spree_integrations.spree.rb
@@ -0,0 +1,13 @@
+# This migration comes from spree (originally 20250407085228)
+class CreateSpreeIntegrations < ActiveRecord::Migration[7.2]
+ def change
+ create_table :spree_integrations, if_not_exists: true do |t|
+ t.references :store, null: false, index: true
+ t.string :type, null: false, index: true
+ t.text :preferences
+ t.boolean :active, default: false, null: false, index: true
+
+ t.timestamps
+ end
+ end
+end
diff --git a/server/db/migrate/20260317146040_create_spree_invitations.spree.rb b/server/db/migrate/20260317146040_create_spree_invitations.spree.rb
new file mode 100644
index 0000000000..10c22b958e
--- /dev/null
+++ b/server/db/migrate/20260317146040_create_spree_invitations.spree.rb
@@ -0,0 +1,21 @@
+# This migration comes from spree (originally 20250410061306)
+class CreateSpreeInvitations < ActiveRecord::Migration[7.2]
+ def change
+ create_table :spree_invitations do |t|
+ t.string :email, index: true, null: false
+ t.string :token, index: { unique: true }, null: false
+ t.string :status, null: false, index: true
+
+ t.references :resource, polymorphic: true, index: true, null: false # eg. Store, Vendor, Account
+ t.references :inviter, polymorphic: true, index: true, null: false
+ t.references :invitee, polymorphic: true, index: true
+ t.references :role, null: false
+
+ t.datetime :accepted_at
+ t.datetime :expires_at, index: true
+ t.datetime :deleted_at, index: true
+
+ t.timestamps
+ end
+ end
+end
diff --git a/server/db/migrate/20260317146041_add_resource_to_spree_role_users.spree.rb b/server/db/migrate/20260317146041_add_resource_to_spree_role_users.spree.rb
new file mode 100644
index 0000000000..963ef92db2
--- /dev/null
+++ b/server/db/migrate/20260317146041_add_resource_to_spree_role_users.spree.rb
@@ -0,0 +1,9 @@
+# This migration comes from spree (originally 20250418174652)
+class AddResourceToSpreeRoleUsers < ActiveRecord::Migration[7.2]
+ def change
+ add_reference :spree_role_users, :resource, polymorphic: true, null: true
+ add_reference :spree_role_users, :invitation, null: true
+
+ add_index :spree_role_users, [:resource_id, :resource_type, :user_id, :user_type, :role_id], unique: true
+ end
+end
diff --git a/server/db/migrate/20260317146042_create_spree_gift_cards_and_spree_gift_card_batches.spree.rb b/server/db/migrate/20260317146042_create_spree_gift_cards_and_spree_gift_card_batches.spree.rb
new file mode 100644
index 0000000000..41111ac574
--- /dev/null
+++ b/server/db/migrate/20260317146042_create_spree_gift_cards_and_spree_gift_card_batches.spree.rb
@@ -0,0 +1,38 @@
+# This migration comes from spree (originally 20250506073057)
+class CreateSpreeGiftCardsAndSpreeGiftCardBatches < ActiveRecord::Migration[7.2]
+ def change
+ create_table :spree_gift_card_batches, if_not_exists: true do |t|
+ t.references :store, null: false, index: true
+ t.references :created_by
+ t.integer :codes_count, default: 1, null: false
+ t.decimal :amount, precision: 10, scale: 2, null: false
+ t.string :currency, null: false
+ t.string :prefix
+ t.date :expires_at
+
+ t.timestamps
+ end
+
+ create_table :spree_gift_cards, if_not_exists: true do |t|
+ t.references :store, null: false, index: true
+ t.references :user, index: true
+ t.references :gift_card_batch, index: true
+ t.references :created_by, index: true
+ t.string :code, null: false
+ t.string :state, null: false, index: true
+ t.decimal :amount, precision: 10, scale: 2, null: false
+ t.decimal :amount_authorized, precision: 10, scale: 2, null: false, default: 0
+ t.decimal :amount_used, precision: 10, scale: 2, null: false, default: 0
+ t.string :currency, null: false
+
+ t.date :expires_at, index: true
+ t.datetime :redeemed_at, index: true
+ t.timestamps
+ end
+
+ add_index :spree_gift_cards, :code, unique: { scope: :store_id }
+
+ add_column :spree_orders, :gift_card_id, :bigint, if_not_exists: true
+ add_index :spree_orders, :gift_card_id, if_not_exists: true
+ end
+end
diff --git a/server/db/migrate/20260317146043_add_selected_locale_to_spree_admin_users.spree.rb b/server/db/migrate/20260317146043_add_selected_locale_to_spree_admin_users.spree.rb
new file mode 100644
index 0000000000..c652c274c4
--- /dev/null
+++ b/server/db/migrate/20260317146043_add_selected_locale_to_spree_admin_users.spree.rb
@@ -0,0 +1,9 @@
+# This migration comes from spree (originally 20250508060800)
+class AddSelectedLocaleToSpreeAdminUsers < ActiveRecord::Migration[7.2]
+ def change
+ if Spree.admin_user_class.present?
+ users_table_name = Spree.admin_user_class.table_name
+ add_column users_table_name, :selected_locale, :string unless column_exists?(users_table_name, :selected_locale)
+ end
+ end
+end
diff --git a/server/db/migrate/20260317146044_add_session_id_to_spree_assets.spree.rb b/server/db/migrate/20260317146044_add_session_id_to_spree_assets.spree.rb
new file mode 100644
index 0000000000..25733b73c6
--- /dev/null
+++ b/server/db/migrate/20260317146044_add_session_id_to_spree_assets.spree.rb
@@ -0,0 +1,6 @@
+# This migration comes from spree (originally 20250509143831)
+class AddSessionIdToSpreeAssets < ActiveRecord::Migration[7.2]
+ def change
+ add_column :spree_assets, :session_id, :string
+ end
+end
diff --git a/server/db/migrate/20260317146045_add_company_to_spree_stock_locations.spree.rb b/server/db/migrate/20260317146045_add_company_to_spree_stock_locations.spree.rb
new file mode 100644
index 0000000000..a60e766f56
--- /dev/null
+++ b/server/db/migrate/20260317146045_add_company_to_spree_stock_locations.spree.rb
@@ -0,0 +1,6 @@
+# This migration comes from spree (originally 20250527134027)
+class AddCompanyToSpreeStockLocations < ActiveRecord::Migration[7.2]
+ def change
+ add_column :spree_stock_locations, :company, :string, if_not_exists: true
+ end
+end
diff --git a/server/db/migrate/20260317146046_enable_pg_trgm_extension.spree.rb b/server/db/migrate/20260317146046_enable_pg_trgm_extension.spree.rb
new file mode 100644
index 0000000000..a1a658dc74
--- /dev/null
+++ b/server/db/migrate/20260317146046_enable_pg_trgm_extension.spree.rb
@@ -0,0 +1,14 @@
+# This migration comes from spree (originally 20250530101236)
+class EnablePgTrgmExtension < ActiveRecord::Migration[7.2]
+ def up
+ if supports_extensions? && extension_available?('pg_trgm') && !extension_enabled?('pg_trgm')
+ enable_extension 'pg_trgm'
+ end
+ end
+
+ def down
+ if supports_extensions? && extension_available?('pg_trgm') && extension_enabled?('pg_trgm')
+ disable_extension 'pg_trgm'
+ end
+ end
+end
diff --git a/server/db/migrate/20260317146047_add_missing_fields_to_users.spree.rb b/server/db/migrate/20260317146047_add_missing_fields_to_users.spree.rb
new file mode 100644
index 0000000000..3c0fb7ef2c
--- /dev/null
+++ b/server/db/migrate/20260317146047_add_missing_fields_to_users.spree.rb
@@ -0,0 +1,36 @@
+# This migration comes from spree (originally 20250605131334)
+# these fields were not present when someone used a custom user class
+# so we need to ensure this is setup properly
+class AddMissingFieldsToUsers < ActiveRecord::Migration[7.2]
+ def change
+ users_table = Spree.user_class.table_name
+ admin_users_table = Spree.admin_user_class.table_name
+
+ change_table users_table do |t|
+ t.string :login unless column_exists?(users_table, :login)
+
+ if t.respond_to? :jsonb
+ t.jsonb :public_metadata unless column_exists?(users_table, :public_metadata)
+ t.jsonb :private_metadata unless column_exists?(users_table, :private_metadata)
+ else
+ t.json :public_metadata unless column_exists?(users_table, :public_metadata)
+ t.json :private_metadata unless column_exists?(users_table, :private_metadata)
+ end
+ end
+
+ add_reference users_table, :bill_address, if_not_exists: true
+ add_reference users_table, :ship_address, if_not_exists: true
+
+ change_table admin_users_table do |t|
+ t.string :login unless column_exists?(admin_users_table, :login)
+
+ if t.respond_to? :jsonb
+ t.jsonb :public_metadata unless column_exists?(admin_users_table, :public_metadata)
+ t.jsonb :private_metadata unless column_exists?(admin_users_table, :private_metadata)
+ else
+ t.json :public_metadata unless column_exists?(admin_users_table, :public_metadata)
+ t.json :private_metadata unless column_exists?(admin_users_table, :private_metadata)
+ end
+ end
+ end
+end
diff --git a/server/db/migrate/20260317146048_create_spree_metafields.spree.rb b/server/db/migrate/20260317146048_create_spree_metafields.spree.rb
new file mode 100644
index 0000000000..2dc09e7281
--- /dev/null
+++ b/server/db/migrate/20260317146048_create_spree_metafields.spree.rb
@@ -0,0 +1,28 @@
+# This migration comes from spree (originally 20250728095629)
+class CreateSpreeMetafields < ActiveRecord::Migration[7.2]
+ def change
+ create_table :spree_metafield_definitions do |t|
+ t.string :namespace, null: false
+ t.string :key, null: false
+ t.string :name, null: false
+ t.string :metafield_type, null: false
+ t.string :resource_type, null: false, index: true
+ t.string :display_on, null: false, default: 'both', index: true
+ t.timestamps
+
+ t.index [:namespace, :key]
+ t.index [:resource_type, :namespace, :key], unique: true
+ end
+
+ create_table :spree_metafields do |t|
+ t.string :type, null: false, index: true
+ t.references :resource, polymorphic: true, null: false, index: true
+ t.references :metafield_definition, null: false, index: true
+ t.text :value
+
+ t.timestamps
+
+ t.index [:resource_type, :resource_id, :metafield_definition_id], name: 'index_metafields_on_resource_and_definition', unique: true
+ end
+ end
+end
diff --git a/server/db/migrate/20260317146049_add_missing_unique_indexes_to_spree_option_types_and_values.spree.rb b/server/db/migrate/20260317146049_add_missing_unique_indexes_to_spree_option_types_and_values.spree.rb
new file mode 100644
index 0000000000..f0155962aa
--- /dev/null
+++ b/server/db/migrate/20260317146049_add_missing_unique_indexes_to_spree_option_types_and_values.spree.rb
@@ -0,0 +1,41 @@
+# This migration comes from spree (originally 20250730102644)
+class AddMissingUniqueIndexesToSpreeOptionTypesAndValues < ActiveRecord::Migration[7.2]
+ def change
+ # we don't need to run this migration in multi-tenant mode as it's already handled there
+ return if defined?(SpreeMultiTenant)
+
+ # Rename duplicated option types
+ duplicates = Spree::OptionType.select(:name).group(:name).having('COUNT(*) > 1').reorder('').pluck(:name)
+
+ duplicates.each do |duplicate_name|
+ option_types = Spree::OptionType.where(name: duplicate_name)
+
+ option_types.each_with_index do |option_type, index|
+ next if index == 0 # Keep the first one unchanged
+
+ new_name = "#{duplicate_name}_#{index}"
+ option_type.update_columns(name: new_name, updated_at: Time.current)
+ end
+ end
+
+ # Handle duplicates in spree_option_values
+ duplicates = Spree::OptionValue.select(:option_type_id, :name).group(:option_type_id, :name).having('COUNT(*) > 1').reorder('')
+
+ duplicates.each do |dup|
+ option_values = Spree::OptionValue.where(option_type_id: dup.option_type_id, name: dup.name)
+
+ option_values.each_with_index do |option_value, index|
+ next if index == 0 # Keep the first one unchanged
+
+ new_name = "#{option_value.name}_#{index}"
+ option_value.update_columns(name: new_name, updated_at: Time.current)
+ end
+ end
+
+ # Add indexes
+ remove_index :spree_option_types, :name, if_exists: true
+ add_index :spree_option_types, :name, unique: true, if_not_exists: true
+
+ add_index :spree_option_values, %i[option_type_id name], unique: true, if_not_exists: true
+ end
+end
diff --git a/server/db/migrate/20260317146050_create_spree_policies.spree.rb b/server/db/migrate/20260317146050_create_spree_policies.spree.rb
new file mode 100644
index 0000000000..6a1a0d3a0d
--- /dev/null
+++ b/server/db/migrate/20260317146050_create_spree_policies.spree.rb
@@ -0,0 +1,23 @@
+# This migration comes from spree (originally 20250811112056)
+class CreateSpreePolicies < ActiveRecord::Migration[7.2]
+ def change
+ create_table :spree_policies do |t|
+ t.belongs_to :store, null: false
+ t.string :slug, null: false
+ t.string :name, null: false
+
+ t.timestamps
+ end
+
+ add_index :spree_policies, [:store_id, :slug], unique: true
+ create_table :spree_policy_translations do |t|
+ t.string :locale, null: false
+ t.string :name
+ t.references :spree_policy, null: false
+
+ t.timestamps
+ end
+
+ add_index :spree_policy_translations, [:spree_policy_id, :locale], unique: true
+ end
+end
diff --git a/server/db/migrate/20260317146051_fix_unique_index_on_spree_order_promotions.spree.rb b/server/db/migrate/20260317146051_fix_unique_index_on_spree_order_promotions.spree.rb
new file mode 100644
index 0000000000..8260e9771c
--- /dev/null
+++ b/server/db/migrate/20260317146051_fix_unique_index_on_spree_order_promotions.spree.rb
@@ -0,0 +1,21 @@
+# This migration comes from spree (originally 20250821211705)
+class FixUniqueIndexOnSpreeOrderPromotions < ActiveRecord::Migration[7.2]
+ def change
+ remove_index :spree_order_promotions, name: 'index_spree_order_promotions_on_promotion_id_and_order_id', if_exists: true
+
+ # Remove duplicate records before adding unique index
+ duplicates = Spree::OrderPromotion.select(:promotion_id, :order_id).group(:promotion_id, :order_id).having('COUNT(*) > 1').reorder('').pluck(:promotion_id, :order_id)
+
+ duplicates.each do |duplicate_promotion_id, duplicate_order_id|
+ order_promotions = Spree::OrderPromotion.where(promotion_id: duplicate_promotion_id, order_id: duplicate_order_id)
+
+ order_promotions.each_with_index do |order_promotion, index|
+ next if index == 0 # Keep the first one unchanged
+
+ order_promotion.destroy
+ end
+ end
+
+ add_index :spree_order_promotions, [:promotion_id, :order_id], unique: true, name: 'index_spree_order_promotions_on_promotion_id_and_order_id'
+ end
+end
diff --git a/server/db/migrate/20260317146052_create_spree_newsletter_subscribers.spree.rb b/server/db/migrate/20260317146052_create_spree_newsletter_subscribers.spree.rb
new file mode 100644
index 0000000000..a360c8b259
--- /dev/null
+++ b/server/db/migrate/20260317146052_create_spree_newsletter_subscribers.spree.rb
@@ -0,0 +1,13 @@
+# This migration comes from spree (originally 20250826093602)
+class CreateSpreeNewsletterSubscribers < ActiveRecord::Migration[7.2]
+ def change
+ create_table :spree_newsletter_subscribers do |t|
+ t.string :email, index: { unique: true }, null: false
+ t.references :user, index: true
+ t.datetime :verified_at, index: true
+ t.string :verification_token, index: { unique: true }
+
+ t.timestamps
+ end
+ end
+end
diff --git a/server/db/migrate/20260317146053_fix_policies_store_association.spree.rb b/server/db/migrate/20260317146053_fix_policies_store_association.spree.rb
new file mode 100644
index 0000000000..ba879c333e
--- /dev/null
+++ b/server/db/migrate/20260317146053_fix_policies_store_association.spree.rb
@@ -0,0 +1,19 @@
+# This migration comes from spree (originally 20250902143122)
+class FixPoliciesStoreAssociation < ActiveRecord::Migration[7.2]
+ def change
+ add_reference :spree_policies, :owner, polymorphic: true, index: true
+
+ Spree::Policy.reset_column_information
+ Spree::Policy.all.each do |policy|
+ policy.update(owner_id: policy.store_id, owner_type: 'Spree::Store')
+ end
+
+ remove_index :spree_policies, [:store_id, :slug], unique: true, if_exists: true
+ remove_index :spree_policies, [:store_id, :position], if_exists: true
+ remove_column :spree_policies, :store_id, if_exists: true
+ remove_column :spree_policies, :show_in_checkout_footer, if_exists: true
+ remove_column :spree_policies, :position, if_exists: true
+
+ add_index :spree_policies, [:owner_id, :owner_type, :slug], unique: true
+ end
+end
diff --git a/server/db/migrate/20260317146054_add_missing_index_on_spree_products_promotionable.spree.rb b/server/db/migrate/20260317146054_add_missing_index_on_spree_products_promotionable.spree.rb
new file mode 100644
index 0000000000..7d1850d715
--- /dev/null
+++ b/server/db/migrate/20260317146054_add_missing_index_on_spree_products_promotionable.spree.rb
@@ -0,0 +1,6 @@
+# This migration comes from spree (originally 20250911205659)
+class AddMissingIndexOnSpreeProductsPromotionable < ActiveRecord::Migration[7.2]
+ def change
+ add_index :spree_products, :promotionable, if_not_exists: true
+ end
+end
diff --git a/server/db/migrate/20260317146055_add_missing_indexes_on_spree_adjustments.spree.rb b/server/db/migrate/20260317146055_add_missing_indexes_on_spree_adjustments.spree.rb
new file mode 100644
index 0000000000..79fa4e207c
--- /dev/null
+++ b/server/db/migrate/20260317146055_add_missing_indexes_on_spree_adjustments.spree.rb
@@ -0,0 +1,7 @@
+# This migration comes from spree (originally 20250914101955)
+class AddMissingIndexesOnSpreeAdjustments < ActiveRecord::Migration[7.2]
+ def change
+ add_index :spree_adjustments, :source_type, if_not_exists: true
+ add_index :spree_adjustments, :amount, if_not_exists: true
+ end
+end
diff --git a/server/db/migrate/20260317146056_add_metadata_to_spree_newsletter_subscribers.spree.rb b/server/db/migrate/20260317146056_add_metadata_to_spree_newsletter_subscribers.spree.rb
new file mode 100644
index 0000000000..fa79698a73
--- /dev/null
+++ b/server/db/migrate/20260317146056_add_metadata_to_spree_newsletter_subscribers.spree.rb
@@ -0,0 +1,21 @@
+# This migration comes from spree (originally 20250915093930)
+class AddMetadataToSpreeNewsletterSubscribers < ActiveRecord::Migration[7.2]
+ def up
+ change_table :spree_newsletter_subscribers do |t|
+ if t.respond_to? :jsonb
+ t.jsonb :public_metadata
+ t.jsonb :private_metadata
+ else
+ t.json :public_metadata
+ t.json :private_metadata
+ end
+ end
+ end
+
+ def down
+ change_table :spree_newsletter_subscribers do |t|
+ t.remove :public_metadata
+ t.remove :private_metadata
+ end
+ end
+end
diff --git a/server/db/migrate/20260317146057_create_spree_imports.spree.rb b/server/db/migrate/20260317146057_create_spree_imports.spree.rb
new file mode 100644
index 0000000000..f35482573c
--- /dev/null
+++ b/server/db/migrate/20260317146057_create_spree_imports.spree.rb
@@ -0,0 +1,48 @@
+# This migration comes from spree (originally 20250923141845)
+class CreateSpreeImports < ActiveRecord::Migration[7.2]
+ def change
+ create_table :spree_imports do |t|
+ t.belongs_to :user, null: false
+ t.belongs_to :owner, polymorphic: true, null: false
+
+ t.string :status, null: false, index: true
+
+ t.string :number, limit: 32, null: false, index: { unique: true }
+ t.string :type, null: false, index: true
+
+ t.text :processing_errors
+
+ t.text :preferences
+
+ t.integer :rows_count, null: false, default: 0
+
+ t.timestamps
+ end
+
+ create_table :spree_import_rows do |t|
+ t.belongs_to :import, null: false
+ t.belongs_to :item, polymorphic: true
+
+ t.string :status, null: false, index: true
+ t.integer :row_number, null: false
+
+ t.text :data, null: false
+ t.text :validation_errors
+
+ t.timestamps
+ end
+
+ add_index :spree_import_rows, [:import_id, :row_number], unique: true
+
+ create_table :spree_import_mappings do |t|
+ t.belongs_to :import, null: false
+
+ t.string :schema_field, null: false
+ t.string :file_column, index: true
+
+ t.timestamps
+ end
+
+ add_index :spree_import_mappings, [:import_id, :schema_field], unique: true
+ end
+end
diff --git a/server/db/migrate/20260317146058_create_spree_user_identities.spree.rb b/server/db/migrate/20260317146058_create_spree_user_identities.spree.rb
new file mode 100644
index 0000000000..3842b86614
--- /dev/null
+++ b/server/db/migrate/20260317146058_create_spree_user_identities.spree.rb
@@ -0,0 +1,18 @@
+# This migration comes from spree (originally 20250923141900)
+class CreateSpreeUserIdentities < ActiveRecord::Migration[7.0]
+ def change
+ create_table :spree_user_identities do |t|
+ t.references :user, polymorphic: true, null: false, index: true
+ t.string :provider, null: false
+ t.string :uid, null: false
+ t.json :info
+ t.string :access_token
+ t.string :refresh_token
+ t.datetime :expires_at
+
+ t.timestamps
+ end
+
+ add_index :spree_user_identities, [:provider, :uid, :user_type], unique: true, name: 'index_spree_user_identities_on_provider_uid_user_type'
+ end
+end
diff --git a/server/db/migrate/20260317146059_create_spree_price_lists.spree.rb b/server/db/migrate/20260317146059_create_spree_price_lists.spree.rb
new file mode 100644
index 0000000000..7661893d87
--- /dev/null
+++ b/server/db/migrate/20260317146059_create_spree_price_lists.spree.rb
@@ -0,0 +1,23 @@
+# This migration comes from spree (originally 20251110120000)
+class CreateSpreePriceLists < ActiveRecord::Migration[7.0]
+ def change
+ create_table :spree_price_lists do |t|
+ t.belongs_to :store, null: false, foreign_key: false, index: true
+ t.string :name, null: false
+ t.text :description
+ t.integer :position, null: false, default: 0
+ t.string :status, null: false, default: 'draft'
+ t.datetime :starts_at
+ t.datetime :ends_at
+ t.string :match_policy, null: false, default: 'all'
+ t.timestamps
+ t.datetime :deleted_at
+ end
+
+ add_index :spree_price_lists, :status
+ add_index :spree_price_lists, :position
+ add_index :spree_price_lists, [:starts_at, :ends_at]
+ add_index :spree_price_lists, :deleted_at
+ add_index :spree_price_lists, [:store_id, :status, :position]
+ end
+end
diff --git a/server/db/migrate/20260317146060_create_spree_price_rules.spree.rb b/server/db/migrate/20260317146060_create_spree_price_rules.spree.rb
new file mode 100644
index 0000000000..ced9ac0202
--- /dev/null
+++ b/server/db/migrate/20260317146060_create_spree_price_rules.spree.rb
@@ -0,0 +1,14 @@
+# This migration comes from spree (originally 20251110120001)
+class CreateSpreePriceRules < ActiveRecord::Migration[7.0]
+ def change
+ create_table :spree_price_rules do |t|
+ t.belongs_to :price_list, null: false, foreign_key: false, index: true
+ t.string :type, null: false
+ t.text :preferences
+ t.timestamps
+ end
+
+ add_index :spree_price_rules, [:price_list_id, :type]
+ add_index :spree_price_rules, :type
+ end
+end
diff --git a/server/db/migrate/20260317146061_add_price_list_id_to_spree_prices.spree.rb b/server/db/migrate/20260317146061_add_price_list_id_to_spree_prices.spree.rb
new file mode 100644
index 0000000000..3c9d94aa0a
--- /dev/null
+++ b/server/db/migrate/20260317146061_add_price_list_id_to_spree_prices.spree.rb
@@ -0,0 +1,7 @@
+# This migration comes from spree (originally 20251110120002)
+class AddPriceListIdToSpreePrices < ActiveRecord::Migration[7.0]
+ def change
+ add_reference :spree_prices, :price_list, null: true
+ add_index :spree_prices, [:variant_id, :currency, :price_list_id], name: 'index_spree_prices_on_variant_currency_price_list', unique: true
+ end
+end
diff --git a/server/db/migrate/20260317146062_add_price_list_id_to_spree_line_items.spree.rb b/server/db/migrate/20260317146062_add_price_list_id_to_spree_line_items.spree.rb
new file mode 100644
index 0000000000..16c898bf98
--- /dev/null
+++ b/server/db/migrate/20260317146062_add_price_list_id_to_spree_line_items.spree.rb
@@ -0,0 +1,6 @@
+# This migration comes from spree (originally 20251110120003)
+class AddPriceListIdToSpreeLineItems < ActiveRecord::Migration[7.0]
+ def change
+ add_reference :spree_line_items, :price_list, null: true
+ end
+end
diff --git a/server/db/migrate/20260317146063_fix_indexes_on_friendly_id_slugs.spree.rb b/server/db/migrate/20260317146063_fix_indexes_on_friendly_id_slugs.spree.rb
new file mode 100644
index 0000000000..15bb8bb07e
--- /dev/null
+++ b/server/db/migrate/20260317146063_fix_indexes_on_friendly_id_slugs.spree.rb
@@ -0,0 +1,9 @@
+# This migration comes from spree (originally 20251201172118)
+class FixIndexesOnFriendlyIdSlugs < ActiveRecord::Migration[7.2]
+ def change
+ remove_index :friendly_id_slugs, [:slug, :sluggable_type, :locale]
+ add_index :friendly_id_slugs, [:slug, :sluggable_type, :locale], length: { slug: 140, sluggable_type: 50, locale: 5 }
+ remove_index :friendly_id_slugs, [:slug, :sluggable_type, :scope, :locale]
+ add_index :friendly_id_slugs, [:slug, :sluggable_type, :scope, :locale], length: { slug: 70, sluggable_type: 50, scope: 70, locale: 5 }, unique: true, name: :index_friendly_id_slugs_unique
+ end
+end
diff --git a/server/db/migrate/20260317146064_create_spree_webhook_endpoints.spree.rb b/server/db/migrate/20260317146064_create_spree_webhook_endpoints.spree.rb
new file mode 100644
index 0000000000..74c0cd21b0
--- /dev/null
+++ b/server/db/migrate/20260317146064_create_spree_webhook_endpoints.spree.rb
@@ -0,0 +1,20 @@
+# frozen_string_literal: true
+
+# This migration comes from spree (originally 20251214000001)
+class CreateSpreeWebhookEndpoints < ActiveRecord::Migration[7.0]
+ def change
+ create_table :spree_webhook_endpoints do |t|
+ t.belongs_to :store, null: false, foreign_key: false, index: true
+ t.string :url, null: false
+ t.boolean :active, null: false, default: true, index: true
+ if t.respond_to? :jsonb
+ t.jsonb :subscriptions, null: false
+ else
+ t.json :subscriptions, null: false
+ end
+ t.string :secret_key, null: false
+ t.datetime :deleted_at, index: true
+ t.timestamps
+ end
+ end
+end
diff --git a/server/db/migrate/20260317146065_create_spree_webhook_deliveries.spree.rb b/server/db/migrate/20260317146065_create_spree_webhook_deliveries.spree.rb
new file mode 100644
index 0000000000..ec02564dab
--- /dev/null
+++ b/server/db/migrate/20260317146065_create_spree_webhook_deliveries.spree.rb
@@ -0,0 +1,24 @@
+# frozen_string_literal: true
+
+# This migration comes from spree (originally 20251214000002)
+class CreateSpreeWebhookDeliveries < ActiveRecord::Migration[7.0]
+ def change
+ create_table :spree_webhook_deliveries do |t|
+ t.belongs_to :webhook_endpoint, null: false, foreign_key: false, index: true
+ t.string :event_name, null: false, index: true
+ if t.respond_to?(:jsonb)
+ t.jsonb :payload, null: false
+ else
+ t.json :payload, null: false
+ end
+ t.integer :response_code, index: true
+ t.text :response_body
+ t.string :error_type
+ t.integer :execution_time
+ t.text :request_errors
+ t.boolean :success, index: true
+ t.datetime :delivered_at, index: true
+ t.timestamps
+ end
+ end
+end
diff --git a/server/db/migrate/20260317146066_add_performance_indexes_to_spree_adjustments.spree.rb b/server/db/migrate/20260317146066_add_performance_indexes_to_spree_adjustments.spree.rb
new file mode 100644
index 0000000000..90a68a480a
--- /dev/null
+++ b/server/db/migrate/20260317146066_add_performance_indexes_to_spree_adjustments.spree.rb
@@ -0,0 +1,26 @@
+# This migration comes from spree (originally 20251222000000)
+class AddPerformanceIndexesToSpreeAdjustments < ActiveRecord::Migration[7.2]
+ def change
+ # Composite index for filtering adjustments by order, type and eligibility
+ # Used in OrderUpdater#update_adjustment_total when summing eligible adjustments
+ # and filtering by source_type (e.g., promotion adjustments)
+ add_index :spree_adjustments,
+ [:order_id, :eligible, :source_type],
+ name: 'index_spree_adjustments_on_order_eligible_source_type',
+ if_not_exists: true
+
+ # Composite index for AdjustmentsUpdater queries that filter by adjustable and source type
+ # Used when recalculating tax and promotion adjustments for a specific adjustable
+ add_index :spree_adjustments,
+ [:adjustable_type, :adjustable_id, :source_type],
+ name: 'index_spree_adjustments_on_adjustable_and_source_type',
+ if_not_exists: true
+
+ # Index for state-based filtering (open/closed adjustments)
+ # Used in Adjustment.not_finalized and Adjustment.finalized scopes
+ add_index :spree_adjustments,
+ [:order_id, :state],
+ name: 'index_spree_adjustments_on_order_id_and_state',
+ if_not_exists: true
+ end
+end
diff --git a/server/db/migrate/20260317146067_fix_spree_prices_unique_indexes.spree.rb b/server/db/migrate/20260317146067_fix_spree_prices_unique_indexes.spree.rb
new file mode 100644
index 0000000000..6496809a2d
--- /dev/null
+++ b/server/db/migrate/20260317146067_fix_spree_prices_unique_indexes.spree.rb
@@ -0,0 +1,34 @@
+# This migration comes from spree (originally 20260112000000)
+class FixSpreePricesUniqueIndexes < ActiveRecord::Migration[7.0]
+ def change
+ remove_index :spree_prices, name: 'index_spree_prices_on_variant_currency_price_list', if_exists: true
+
+ if ActiveRecord::Base.connection.adapter_name == 'Mysql2'
+ # MySQL doesn't support partial indexes, so we use a composite unique index
+ # that includes price_list_id. NULL values are treated as distinct in MySQL unique indexes,
+ # so this allows multiple base prices (price_list_id = NULL) per variant/currency
+ # but only one price per variant/currency/price_list combination.
+ # Keep existing index_spree_prices_on_variant_id_and_currency as-is (non-unique, for performance).
+ add_index :spree_prices, [:variant_id, :currency, :price_list_id],
+ name: 'index_spree_prices_on_variant_currency_price_list',
+ unique: true
+ else
+ # PostgreSQL and SQLite support partial indexes
+ remove_index :spree_prices, name: 'index_spree_prices_on_variant_id_and_currency', if_exists: true
+
+ # Add unique index for base prices only (price_list_id IS NULL)
+ # The amount IS NOT NULL condition allows placeholder prices with nil amounts
+ add_index :spree_prices, [:variant_id, :currency],
+ name: 'index_spree_prices_on_variant_id_and_currency',
+ unique: true,
+ where: 'price_list_id IS NULL AND deleted_at IS NULL AND amount IS NOT NULL'
+
+ # Add unique index for price list prices (one price per variant/currency/price_list)
+ # The amount IS NOT NULL condition allows placeholder prices with nil amounts
+ add_index :spree_prices, [:variant_id, :currency, :price_list_id],
+ name: 'index_spree_prices_on_variant_currency_price_list',
+ unique: true,
+ where: 'price_list_id IS NOT NULL AND deleted_at IS NULL AND amount IS NOT NULL'
+ end
+ end
+end
diff --git a/server/db/migrate/20260317146068_create_spree_customer_groups.spree.rb b/server/db/migrate/20260317146068_create_spree_customer_groups.spree.rb
new file mode 100644
index 0000000000..195b4ae18f
--- /dev/null
+++ b/server/db/migrate/20260317146068_create_spree_customer_groups.spree.rb
@@ -0,0 +1,15 @@
+# This migration comes from spree (originally 20260115120000)
+class CreateSpreeCustomerGroups < ActiveRecord::Migration[7.0]
+ def change
+ create_table :spree_customer_groups do |t|
+ t.references :store, null: false, index: true
+ t.string :name, null: false
+ t.text :description
+ t.timestamps
+ t.datetime :deleted_at
+ end
+
+ add_index :spree_customer_groups, [:store_id, :name], unique: true, where: 'deleted_at IS NULL'
+ add_index :spree_customer_groups, :deleted_at
+ end
+end
diff --git a/server/db/migrate/20260317146069_create_spree_customer_group_users.spree.rb b/server/db/migrate/20260317146069_create_spree_customer_group_users.spree.rb
new file mode 100644
index 0000000000..89b3589a21
--- /dev/null
+++ b/server/db/migrate/20260317146069_create_spree_customer_group_users.spree.rb
@@ -0,0 +1,15 @@
+# This migration comes from spree (originally 20260115120001)
+class CreateSpreeCustomerGroupUsers < ActiveRecord::Migration[7.0]
+ def change
+ create_table :spree_customer_group_users do |t|
+ t.references :customer_group, null: false, index: true
+ t.references :user, polymorphic: true, null: false, index: true
+ t.timestamps
+ end
+
+ add_index :spree_customer_group_users,
+ [:customer_group_id, :user_id, :user_type],
+ unique: true,
+ name: 'index_spree_customer_group_users_unique'
+ end
+end
diff --git a/server/db/migrate/20260317146070_remove_not_null_constraint_from_policy_name.spree.rb b/server/db/migrate/20260317146070_remove_not_null_constraint_from_policy_name.spree.rb
new file mode 100644
index 0000000000..88366c9347
--- /dev/null
+++ b/server/db/migrate/20260317146070_remove_not_null_constraint_from_policy_name.spree.rb
@@ -0,0 +1,6 @@
+# This migration comes from spree (originally 20260117140831)
+class RemoveNotNullConstraintFromPolicyName < ActiveRecord::Migration[7.2]
+ def change
+ change_column_null :spree_policies, :name, true
+ end
+end
diff --git a/server/db/migrate/20260317146071_add_statistics_to_store_products.spree.rb b/server/db/migrate/20260317146071_add_statistics_to_store_products.spree.rb
new file mode 100644
index 0000000000..68ab4a4b7c
--- /dev/null
+++ b/server/db/migrate/20260317146071_add_statistics_to_store_products.spree.rb
@@ -0,0 +1,12 @@
+# This migration comes from spree (originally 20260118120000)
+class AddStatisticsToStoreProducts < ActiveRecord::Migration[7.0]
+ def change
+ add_column :spree_products_stores, :units_sold_count, :integer, default: 0, null: false, if_not_exists: true
+ add_column :spree_products_stores, :revenue, :decimal, precision: 10, scale: 2, default: 0, null: false, if_not_exists: true
+
+ add_index :spree_products_stores, [:store_id, :units_sold_count],
+ name: 'index_products_stores_on_store_and_units_sold', if_not_exists: true
+ add_index :spree_products_stores, [:store_id, :revenue],
+ name: 'index_products_stores_on_store_and_revenue', if_not_exists: true
+ end
+end
diff --git a/server/db/migrate/20260317146072_add_counter_caches_to_spree_products.spree.rb b/server/db/migrate/20260317146072_add_counter_caches_to_spree_products.spree.rb
new file mode 100644
index 0000000000..717451e40c
--- /dev/null
+++ b/server/db/migrate/20260317146072_add_counter_caches_to_spree_products.spree.rb
@@ -0,0 +1,10 @@
+# This migration comes from spree (originally 20260119120000)
+class AddCounterCachesToSpreeProducts < ActiveRecord::Migration[7.2]
+ def change
+ add_column :spree_products, :variant_count, :integer, default: 0, null: false, if_not_exists: true
+ add_column :spree_products, :classification_count, :integer, default: 0, null: false, if_not_exists: true
+
+ add_index :spree_products, :variant_count, if_not_exists: true
+ add_index :spree_products, :classification_count, if_not_exists: true
+ end
+end
diff --git a/server/db/migrate/20260317146073_add_counter_caches_to_spree_taxons.spree.rb b/server/db/migrate/20260317146073_add_counter_caches_to_spree_taxons.spree.rb
new file mode 100644
index 0000000000..da8317db16
--- /dev/null
+++ b/server/db/migrate/20260317146073_add_counter_caches_to_spree_taxons.spree.rb
@@ -0,0 +1,10 @@
+# This migration comes from spree (originally 20260119170000)
+class AddCounterCachesToSpreeTaxons < ActiveRecord::Migration[7.2]
+ def change
+ add_column :spree_taxons, :children_count, :integer, default: 0, null: false, if_not_exists: true
+ add_column :spree_taxons, :classification_count, :integer, default: 0, null: false, if_not_exists: true
+
+ add_index :spree_taxons, :children_count, if_not_exists: true
+ add_index :spree_taxons, :classification_count, if_not_exists: true
+ end
+end
diff --git a/server/db/migrate/20260317146074_add_image_count_to_spree_variants.spree.rb b/server/db/migrate/20260317146074_add_image_count_to_spree_variants.spree.rb
new file mode 100644
index 0000000000..448a95e2a9
--- /dev/null
+++ b/server/db/migrate/20260317146074_add_image_count_to_spree_variants.spree.rb
@@ -0,0 +1,10 @@
+# This migration comes from spree (originally 20260120120000)
+class AddImageCountToSpreeVariants < ActiveRecord::Migration[7.2]
+ def change
+ add_column :spree_variants, :image_count, :integer, default: 0, null: false, if_not_exists: true
+ add_column :spree_products, :total_image_count, :integer, default: 0, null: false, if_not_exists: true
+
+ add_index :spree_variants, :image_count, if_not_exists: true
+ add_index :spree_products, :total_image_count, if_not_exists: true
+ end
+end
diff --git a/server/db/migrate/20260317146075_create_spree_api_keys.spree.rb b/server/db/migrate/20260317146075_create_spree_api_keys.spree.rb
new file mode 100644
index 0000000000..15e15a8b58
--- /dev/null
+++ b/server/db/migrate/20260317146075_create_spree_api_keys.spree.rb
@@ -0,0 +1,20 @@
+# This migration comes from spree (originally 20260123000000)
+class CreateSpreeApiKeys < ActiveRecord::Migration[7.2]
+ def change
+ create_table :spree_api_keys do |t|
+ t.string :name, null: false
+ t.string :key_type, null: false
+ t.string :token, null: false
+ t.references :store, null: false, index: true
+ t.references :created_by, null: true, polymorphic: true, index: true
+ t.datetime :last_used_at
+ t.datetime :revoked_at
+ t.references :revoked_by, null: true, polymorphic: true, index: true
+ t.timestamps
+ end
+
+ add_index :spree_api_keys, :token, unique: true
+ add_index :spree_api_keys, :key_type
+ add_index :spree_api_keys, [:store_id, :key_type]
+ end
+end
diff --git a/server/db/migrate/20260317146076_add_thumbnail_id_to_spree_variants_and_products.spree.rb b/server/db/migrate/20260317146076_add_thumbnail_id_to_spree_variants_and_products.spree.rb
new file mode 100644
index 0000000000..63d9e76eea
--- /dev/null
+++ b/server/db/migrate/20260317146076_add_thumbnail_id_to_spree_variants_and_products.spree.rb
@@ -0,0 +1,10 @@
+# This migration comes from spree (originally 20260131000000)
+class AddThumbnailIdToSpreeVariantsAndProducts < ActiveRecord::Migration[7.2]
+ def change
+ add_column :spree_variants, :thumbnail_id, :bigint, if_not_exists: true
+ add_column :spree_products, :thumbnail_id, :bigint, if_not_exists: true
+
+ add_index :spree_variants, :thumbnail_id, if_not_exists: true
+ add_index :spree_products, :thumbnail_id, if_not_exists: true
+ end
+end
diff --git a/server/db/migrate/20260317146077_create_spree_payment_sessions.spree.rb b/server/db/migrate/20260317146077_create_spree_payment_sessions.spree.rb
new file mode 100644
index 0000000000..51598eec93
--- /dev/null
+++ b/server/db/migrate/20260317146077_create_spree_payment_sessions.spree.rb
@@ -0,0 +1,28 @@
+# This migration comes from spree (originally 20260213000000)
+class CreateSpreePaymentSessions < ActiveRecord::Migration[7.2]
+ def change
+ create_table :spree_payment_sessions do |t|
+ t.string :type, null: false, index: true
+ t.references :order, null: false, index: true
+ t.references :payment_method, null: false, index: true
+ t.references :customer, index: true
+ t.decimal :amount, precision: 10, scale: 2, null: false
+ t.string :currency, null: false
+ t.string :status, null: false, index: true
+ t.string :external_id, null: false
+ if t.respond_to? :jsonb
+ t.jsonb :external_data
+ else
+ t.json :external_data
+ end
+ t.datetime :expires_at, index: true
+ t.string :customer_external_id
+ t.datetime :deleted_at, index: true
+ t.timestamps
+ end
+
+ add_index :spree_payment_sessions, [:order_id, :payment_method_id, :external_id],
+ unique: true, name: 'idx_payment_sessions_order_method_external'
+ add_index :spree_payment_sessions, :external_id
+ end
+end
diff --git a/server/db/migrate/20260317146078_create_spree_payment_setup_sessions.spree.rb b/server/db/migrate/20260317146078_create_spree_payment_setup_sessions.spree.rb
new file mode 100644
index 0000000000..0a602b8010
--- /dev/null
+++ b/server/db/migrate/20260317146078_create_spree_payment_setup_sessions.spree.rb
@@ -0,0 +1,25 @@
+# This migration comes from spree (originally 20260218000000)
+class CreateSpreePaymentSetupSessions < ActiveRecord::Migration[7.2]
+ def change
+ create_table :spree_payment_setup_sessions do |t|
+ t.references :customer, index: true
+ t.references :payment_method, null: false, index: true
+ t.references :payment_source, polymorphic: true, index: { name: 'idx_spree_pss_on_payment_source' }
+ t.string :status, null: false
+ t.string :external_id
+ t.string :external_client_secret
+ if t.respond_to? :jsonb
+ t.jsonb :external_data
+ else
+ t.json :external_data
+ end
+ t.datetime :deleted_at, index: true
+ t.timestamps
+ end
+
+ add_index :spree_payment_setup_sessions, :status
+ add_index :spree_payment_setup_sessions, [:external_id, :payment_method_id],
+ unique: true,
+ name: 'idx_spree_pss_unique_external_id_per_pm'
+ end
+end
diff --git a/server/db/migrate/20260317146079_create_spree_markets.spree.rb b/server/db/migrate/20260317146079_create_spree_markets.spree.rb
new file mode 100644
index 0000000000..0229907337
--- /dev/null
+++ b/server/db/migrate/20260317146079_create_spree_markets.spree.rb
@@ -0,0 +1,30 @@
+# This migration comes from spree (originally 20260220000000)
+class CreateSpreeMarkets < ActiveRecord::Migration[7.2]
+ def change
+ create_table :spree_markets do |t|
+ t.references :store, null: false, foreign_key: false, index: true
+ t.string :name, null: false
+ t.string :currency, null: false
+ t.string :default_locale, null: false
+ t.string :supported_locales
+ t.boolean :tax_inclusive, null: false, default: false
+ t.boolean :default, null: false, default: false
+ t.integer :position, null: false, default: 0
+ t.timestamps
+ t.datetime :deleted_at
+ end
+
+ add_index :spree_markets, [:store_id, :name], unique: true, where: 'deleted_at IS NULL'
+ add_index :spree_markets, [:store_id, :default], where: 'deleted_at IS NULL'
+ add_index :spree_markets, [:store_id, :position]
+ add_index :spree_markets, :deleted_at
+
+ create_table :spree_market_countries do |t|
+ t.references :market, null: false, foreign_key: false
+ t.references :country, null: false, foreign_key: false
+ t.timestamps
+ end
+
+ add_index :spree_market_countries, [:market_id, :country_id], unique: true
+ end
+end
diff --git a/server/db/migrate/20260317146080_add_locale_to_spree_orders.spree.rb b/server/db/migrate/20260317146080_add_locale_to_spree_orders.spree.rb
new file mode 100644
index 0000000000..803bd50130
--- /dev/null
+++ b/server/db/migrate/20260317146080_add_locale_to_spree_orders.spree.rb
@@ -0,0 +1,6 @@
+# This migration comes from spree (originally 20260226000000)
+class AddLocaleToSpreeOrders < ActiveRecord::Migration[7.2]
+ def change
+ add_column :spree_orders, :locale, :string
+ end
+end
diff --git a/server/db/migrate/20260317146081_add_token_digest_to_spree_api_keys.spree.rb b/server/db/migrate/20260317146081_add_token_digest_to_spree_api_keys.spree.rb
new file mode 100644
index 0000000000..90f24849ca
--- /dev/null
+++ b/server/db/migrate/20260317146081_add_token_digest_to_spree_api_keys.spree.rb
@@ -0,0 +1,22 @@
+# This migration comes from spree (originally 20260226100000)
+class AddTokenDigestToSpreeApiKeys < ActiveRecord::Migration[7.2]
+ def change
+ add_column :spree_api_keys, :token_digest, :string
+ add_column :spree_api_keys, :token_prefix, :string
+
+ add_index :spree_api_keys, :token_digest, unique: true
+
+ # Replace the unconditional unique index on token with one that only covers
+ # non-NULL values (publishable keys). Secret keys store token as NULL
+ # and use token_digest for lookups instead.
+ change_column_null :spree_api_keys, :token, true
+ remove_index :spree_api_keys, :token
+ if ActiveRecord::Base.connection.adapter_name == 'Mysql2'
+ # MySQL doesn't support partial indexes, but treats NULL as distinct
+ # in unique indexes so multiple secret keys with NULL token are allowed
+ add_index :spree_api_keys, :token, unique: true
+ else
+ add_index :spree_api_keys, :token, unique: true, where: 'token IS NOT NULL'
+ end
+ end
+end
diff --git a/server/db/migrate/20260317146082_create_spree_allowed_origins.spree.rb b/server/db/migrate/20260317146082_create_spree_allowed_origins.spree.rb
new file mode 100644
index 0000000000..1d32de9535
--- /dev/null
+++ b/server/db/migrate/20260317146082_create_spree_allowed_origins.spree.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+# This migration comes from spree (originally 20260315000000)
+class CreateSpreeAllowedOrigins < ActiveRecord::Migration[7.2]
+ def change
+ create_table :spree_allowed_origins do |t|
+ t.references :store, null: false
+ t.string :origin, null: false
+ t.timestamps
+ end
+
+ add_index :spree_allowed_origins, [:store_id, :origin], unique: true,
+ name: 'index_spree_allowed_origins_on_store_id_and_origin'
+ end
+end
diff --git a/server/db/migrate/20260317146083_add_product_media_support.spree.rb b/server/db/migrate/20260317146083_add_product_media_support.spree.rb
new file mode 100644
index 0000000000..2b4a34e5ba
--- /dev/null
+++ b/server/db/migrate/20260317146083_add_product_media_support.spree.rb
@@ -0,0 +1,22 @@
+# This migration comes from spree (originally 20260315100000)
+class AddProductMediaSupport < ActiveRecord::Migration[7.2]
+ def change
+ add_column :spree_assets, :media_type, :string
+ add_column :spree_assets, :focal_point_x, :decimal, precision: 5, scale: 4
+ add_column :spree_assets, :focal_point_y, :decimal, precision: 5, scale: 4
+ add_column :spree_assets, :external_video_url, :string
+
+ add_index :spree_assets, :media_type
+
+ rename_column :spree_variants, :image_count, :media_count
+ rename_column :spree_products, :total_image_count, :media_count
+ rename_column :spree_variants, :thumbnail_id, :primary_media_id
+ rename_column :spree_products, :thumbnail_id, :primary_media_id
+
+ reversible do |dir|
+ dir.up do
+ Spree::Asset.unscoped.where(media_type: nil).update_all(media_type: 'image')
+ end
+ end
+ end
+end
diff --git a/server/db/migrate/20260317146084_create_spree_refresh_tokens.spree.rb b/server/db/migrate/20260317146084_create_spree_refresh_tokens.spree.rb
new file mode 100644
index 0000000000..2b0fb25b9b
--- /dev/null
+++ b/server/db/migrate/20260317146084_create_spree_refresh_tokens.spree.rb
@@ -0,0 +1,17 @@
+# This migration comes from spree (originally 20260317000000)
+class CreateSpreeRefreshTokens < ActiveRecord::Migration[7.2]
+ def change
+ create_table :spree_refresh_tokens do |t|
+ t.string :token, null: false
+ t.references :user, polymorphic: true, null: false
+ t.datetime :expires_at, null: false
+ t.string :ip_address
+ t.string :user_agent
+ t.timestamps
+ end
+
+ add_index :spree_refresh_tokens, :token, unique: true
+ add_index :spree_refresh_tokens, :expires_at
+ add_index :spree_refresh_tokens, [:user_type, :user_id], name: 'idx_refresh_tokens_user'
+ end
+end
diff --git a/server/db/migrate/20260317150033_setup_spree_stripe_models.spree_stripe.rb b/server/db/migrate/20260317150033_setup_spree_stripe_models.spree_stripe.rb
new file mode 100644
index 0000000000..cea40baa50
--- /dev/null
+++ b/server/db/migrate/20260317150033_setup_spree_stripe_models.spree_stripe.rb
@@ -0,0 +1,42 @@
+# This migration comes from spree_stripe (originally 20250310152812)
+class SetupSpreeStripeModels < ActiveRecord::Migration[7.2]
+ def change
+ create_table :spree_stripe_payment_intents do |t|
+ t.decimal :amount, precision: 10, scale: 2, default: '0.0', null: false
+ t.bigint :order_id, null: false
+ t.bigint :payment_method_id, null: false
+ t.string :stripe_id, null: false
+ t.string :client_secret, null: false
+ t.string :customer_id
+ t.string :ephemeral_key_secret
+ t.string :stripe_payment_method_id
+
+ t.timestamps
+
+ t.index ['order_id', 'stripe_id'], name: 'index_spree_stripe_payment_intents_on_order_id_and_stripe_id', unique: true
+ t.index ['order_id'], name: 'index_spree_stripe_payment_intents_on_order_id'
+ t.index ['payment_method_id'], name: 'index_spree_stripe_payment_intents_on_payment_method_id'
+ end
+
+ create_table :spree_stripe_webhook_keys do |t|
+ t.string :stripe_id, null: false
+ t.string :signing_secret, null: false
+
+ t.timestamps
+
+ t.index ['signing_secret'], name: 'index_spree_stripe_webhook_keys_on_signing_secret', unique: true
+ t.index ['stripe_id'], name: 'index_spree_stripe_webhook_keys_on_stripe_id', unique: true
+ end
+
+ create_table :spree_stripe_payment_methods_webhook_keys do |t|
+ t.bigint :payment_method_id, null: false
+ t.bigint :webhook_key_id, null: false
+
+ t.timestamps
+
+ t.index ['payment_method_id', 'webhook_key_id'], name: 'index_payment_method_id_webhook_key_id_uniqueness', unique: true
+ t.index ['payment_method_id'], name: 'index_payment_methods_webhook_keys_on_payment_method_id'
+ t.index ['webhook_key_id'], name: 'index_payment_methods_webhook_keys_on_webhook_key_id'
+ end
+ end
+end
diff --git a/server/db/schema.rb b/server/db/schema.rb
index 4276db020b..38ec0832a5 100644
--- a/server/db/schema.rb
+++ b/server/db/schema.rb
@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema[8.1].define(version: 2026_03_16_114857) do
+ActiveRecord::Schema[8.1].define(version: 2026_03_17_150033) do
# These are extensions that must be enabled in order to support this database
enable_extension "pg_catalog.plpgsql"
enable_extension "pg_trgm"
@@ -136,11 +136,20 @@ ActiveRecord::Schema[8.1].define(version: 2026_03_16_114857) do
end
create_table "spree_admin_users", force: :cascade do |t|
+ t.datetime "confirmation_sent_at"
+ t.string "confirmation_token"
+ t.datetime "confirmed_at"
t.datetime "created_at", null: false
+ t.datetime "current_sign_in_at"
+ t.string "current_sign_in_ip"
t.string "email", default: "", null: false
t.string "encrypted_password", default: "", null: false
+ t.integer "failed_attempts", default: 0, null: false
t.string "first_name"
t.string "last_name"
+ t.datetime "last_sign_in_at"
+ t.string "last_sign_in_ip"
+ t.datetime "locked_at"
t.string "login"
t.jsonb "private_metadata"
t.jsonb "public_metadata"
@@ -148,9 +157,14 @@ ActiveRecord::Schema[8.1].define(version: 2026_03_16_114857) do
t.datetime "reset_password_sent_at"
t.string "reset_password_token"
t.string "selected_locale"
+ t.integer "sign_in_count", default: 0, null: false
+ t.string "unconfirmed_email"
+ t.string "unlock_token"
t.datetime "updated_at", null: false
+ t.index ["confirmation_token"], name: "index_spree_admin_users_on_confirmation_token", unique: true
t.index ["email"], name: "index_spree_admin_users_on_email", unique: true
t.index ["reset_password_token"], name: "index_spree_admin_users_on_reset_password_token", unique: true
+ t.index ["unlock_token"], name: "index_spree_admin_users_on_unlock_token", unique: true
end
create_table "spree_allowed_origins", force: :cascade do |t|
@@ -1201,6 +1215,21 @@ ActiveRecord::Schema[8.1].define(version: 2026_03_16_114857) do
t.datetime "updated_at", null: false
end
+ create_table "spree_refresh_tokens", force: :cascade do |t|
+ t.datetime "created_at", null: false
+ t.datetime "expires_at", null: false
+ t.string "ip_address"
+ t.string "token", null: false
+ t.datetime "updated_at", null: false
+ t.string "user_agent"
+ t.bigint "user_id", null: false
+ t.string "user_type", null: false
+ t.index ["expires_at"], name: "index_spree_refresh_tokens_on_expires_at"
+ t.index ["token"], name: "index_spree_refresh_tokens_on_token", unique: true
+ t.index ["user_type", "user_id"], name: "idx_refresh_tokens_user"
+ t.index ["user_type", "user_id"], name: "index_spree_refresh_tokens_on_user"
+ end
+
create_table "spree_refund_reasons", force: :cascade do |t|
t.boolean "active", default: true
t.datetime "created_at", null: false