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.

Add `spree` and `devise`

Damian Legawiec231909ff4a27
diff --git a/backend/Gemfile b/backend/Gemfile
index 8cb3f8704c..c3cc750651 100644
--- a/backend/Gemfile
+++ b/backend/Gemfile
@@ -55,3 +55,15 @@ group :development do
# Use console on exceptions pages [https://github.com/rails/web-console]
gem "web-console"
end
+gem "devise"
+gem "spree", path: "../"
+gem "spree_emails", path: "../"
+gem "spree_sample", path: "../"
+gem "spree_admin", path: "../"
+gem "spree_i18n"
+
+group :development, :test do
+ gem "spree_dev_tools"
+ gem "letter_opener"
+ gem "listen"
+end
diff --git a/backend/Procfile.dev b/backend/Procfile.dev
index da151fee94..93d75b7601 100644
--- a/backend/Procfile.dev
+++ b/backend/Procfile.dev
@@ -1,2 +1,3 @@
web: bin/rails server
css: bin/rails tailwindcss:watch
+admin_css: bin/rails spree:admin:tailwindcss:watch
diff --git a/backend/app/assets/config/manifest.js b/backend/app/assets/config/manifest.js
new file mode 100644
index 0000000000..080332f5d1
--- /dev/null
+++ b/backend/app/assets/config/manifest.js
@@ -0,0 +1 @@
+//= link_tree ../builds
diff --git a/backend/app/assets/tailwind/spree_admin.css b/backend/app/assets/tailwind/spree_admin.css
new file mode 100644
index 0000000000..d613eb179b
--- /dev/null
+++ b/backend/app/assets/tailwind/spree_admin.css
@@ -0,0 +1,49 @@
+/*
+ * Spree Admin Tailwind CSS
+ *
+ * This file is the entry point for Spree Admin's Tailwind CSS.
+ * It imports the base styles from the Spree Admin gem and allows
+ * you to add custom admin styles.
+ *
+ * The $SPREE_ADMIN_PATH variable is automatically resolved at build time.
+ */
+
+/* Import Spree Admin base styles from the gem */
+@import "$SPREE_ADMIN_PATH/app/assets/tailwind/spree/admin/index.css";
+
+/* Auto-generated sources for all Spree engines (page_builder, etc.) */
+/* $SPREE_ENGINE_SOURCES */
+
+/* Scan host app's custom admin code for Tailwind classes */
+@source "../../views/spree/admin/**/*.erb";
+@source "../../helpers/spree/admin/**/*.rb";
+@source "../../javascript/spree/admin/**/*.js";
+
+/*
+ * CUSTOMIZATION OPTIONS
+ * =====================
+ *
+ * 1. Override Tailwind theme values (colors, spacing, etc.)
+ * Add after the @import above:
+ *
+ * @theme {
+ * --color-primary-500: #your-color;
+ * --color-gray-100: #your-gray;
+ * }
+ *
+ * 2. Add custom components using Tailwind's @layer directive:
+ *
+ * @layer components {
+ * .my-custom-button {
+ * @apply bg-primary-500 text-white px-4 py-2 rounded;
+ * }
+ * }
+ *
+ * 3. Override admin CSS variables
+ * See admin/app/assets/tailwind/spree/admin/base/_theme.css for available variables
+ *
+ * :root {
+ * --sidebar-width: 280px;
+ * --header-height: 70px;
+ * }
+ */
diff --git a/backend/app/models/spree.rb b/backend/app/models/spree.rb
new file mode 100644
index 0000000000..9a7f95d0f8
--- /dev/null
+++ b/backend/app/models/spree.rb
@@ -0,0 +1,5 @@
+module Spree
+ def self.table_name_prefix
+ "spree_"
+ end
+end
diff --git a/backend/app/models/spree/admin_user.rb b/backend/app/models/spree/admin_user.rb
new file mode 100644
index 0000000000..d72706d50f
--- /dev/null
+++ b/backend/app/models/spree/admin_user.rb
@@ -0,0 +1,8 @@
+class Spree::AdminUser < Spree.base_class
+ # Spree modules
+ include Spree::AdminUserMethods
+ # Include default devise modules. Others available are:
+ # :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
+ devise :database_authenticatable, :registerable,
+ :recoverable, :rememberable, :validatable
+end
diff --git a/backend/app/models/spree/user.rb b/backend/app/models/spree/user.rb
new file mode 100644
index 0000000000..028af6d7b4
--- /dev/null
+++ b/backend/app/models/spree/user.rb
@@ -0,0 +1,10 @@
+class Spree::User < Spree.base_class
+ # Spree modules
+ include Spree::UserAddress
+ include Spree::UserMethods
+ include Spree::UserPaymentSource
+ # Include default devise modules. Others available are:
+ # :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
+ devise :database_authenticatable, :registerable,
+ :recoverable, :rememberable, :validatable
+end
diff --git a/backend/bin/spree b/backend/bin/spree
new file mode 100755
index 0000000000..26bcb1a7c4
--- /dev/null
+++ b/backend/bin/spree
@@ -0,0 +1,10 @@
+#!/usr/bin/env ruby
+# frozen_string_literal: true
+
+#
+# This file was generated by the `bin/rails g spree_cli:install` command.
+# It loads your application's bundled version of spree_cli.
+#
+
+require 'bundler/setup'
+require 'spree_cli'
diff --git a/backend/config/application.rb b/backend/config/application.rb
index 862fbc3f36..78e248ccc1 100644
--- a/backend/config/application.rb
+++ b/backend/config/application.rb
@@ -20,6 +20,13 @@ Bundler.require(*Rails.groups)
module Spree
class Application < Rails::Application
+
+ config.to_prepare do
+ # Load application's model / class decorators
+ Dir.glob(File.join(File.dirname(__FILE__), "../app/**/*_decorator*.rb")) do |c|
+ Rails.configuration.cache_classes ? require(c) : load(c)
+ end
+ end
# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 8.1
diff --git a/backend/config/environments/development.rb b/backend/config/environments/development.rb
index 75243c3d0f..1f2f9feaf9 100644
--- a/backend/config/environments/development.rb
+++ b/backend/config/environments/development.rb
@@ -1,6 +1,12 @@
require "active_support/core_ext/integer/time"
Rails.application.configure do
+ # Letter Opener for email previews
+ config.action_mailer.delivery_method = :letter_opener
+ config.action_mailer.perform_deliveries = true
+
+ # Improved file watching
+ config.file_watcher = ActiveSupport::EventedFileUpdateChecker
# Settings specified here will take precedence over those in config/application.rb.
# Make code changes take effect immediately without server restart.
diff --git a/backend/config/initializers/devise.rb b/backend/config/initializers/devise.rb
new file mode 100644
index 0000000000..38308f7da1
--- /dev/null
+++ b/backend/config/initializers/devise.rb
@@ -0,0 +1,316 @@
+# frozen_string_literal: true
+
+# Assuming you have not yet modified this file, each configuration option below
+# is set to its default value. Note that some are commented out while others
+# are not: uncommented lines are intended to protect your configuration from
+# breaking changes in upgrades (i.e., in the event that future versions of
+# Devise change the default values for those options).
+#
+# Use this hook to configure devise mailer, warden hooks and so forth.
+# Many of these configuration options can be set straight in your model.
+Devise.setup do |config|
+ # The secret key used by Devise. Devise uses this key to generate
+ # random tokens. Changing this key will render invalid all existing
+ # confirmation, reset password and unlock tokens in the database.
+ # Devise will use the `secret_key_base` as its `secret_key`
+ # by default. You can change it below and use your own secret key.
+ # config.secret_key = '7cac1797841be0c896722f2e26e9233da28dae1e62a0b0e86524eb7b17f7314ffa95316adbd94ad013899b5b2523a0ea7da8ca7e0b902862605e18f71c8c1858'
+
+ # ==> Controller configuration
+ # Configure the parent class to the devise controllers.
+ # config.parent_controller = 'DeviseController'
+
+ # ==> Mailer Configuration
+ # Configure the e-mail address which will be shown in Devise::Mailer,
+ # note that it will be overwritten if you use your own mailer class
+ # with default "from" parameter.
+ config.mailer_sender = '[email protected]'
+
+ # Configure the class responsible to send e-mails.
+ # config.mailer = 'Devise::Mailer'
+
+ # Configure the parent class responsible to send e-mails.
+ # config.parent_mailer = 'ActionMailer::Base'
+
+ # ==> ORM configuration
+ # Load and configure the ORM. Supports :active_record (default) and
+ # :mongoid (bson_ext recommended) by default. Other ORMs may be
+ # available as additional gems.
+ require 'devise/orm/active_record'
+
+ # ==> Configuration for any authentication mechanism
+ # Configure which keys are used when authenticating a user. The default is
+ # just :email. You can configure it to use [:username, :subdomain], so for
+ # authenticating a user, both parameters are required. Remember that those
+ # parameters are used only when authenticating and not when retrieving from
+ # session. If you need permissions, you should implement that in a before filter.
+ # You can also supply a hash where the value is a boolean determining whether
+ # or not authentication should be aborted when the value is not present.
+ # config.authentication_keys = [:email]
+
+ # Configure parameters from the request object used for authentication. Each entry
+ # given should be a request method and it will automatically be passed to the
+ # find_for_authentication method and considered in your model lookup. For instance,
+ # if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
+ # The same considerations mentioned for authentication_keys also apply to request_keys.
+ # config.request_keys = []
+
+ # Configure which authentication keys should be case-insensitive.
+ # These keys will be downcased upon creating or modifying a user and when used
+ # to authenticate or find a user. Default is :email.
+ config.case_insensitive_keys = [:email]
+
+ # Configure which authentication keys should have whitespace stripped.
+ # These keys will have whitespace before and after removed upon creating or
+ # modifying a user and when used to authenticate or find a user. Default is :email.
+ config.strip_whitespace_keys = [:email]
+
+ # Tell if authentication through request.params is enabled. True by default.
+ # It can be set to an array that will enable params authentication only for the
+ # given strategies, for example, `config.params_authenticatable = [:database]` will
+ # enable it only for database (email + password) authentication.
+ # config.params_authenticatable = true
+
+ # Tell if authentication through HTTP Auth is enabled. False by default.
+ # It can be set to an array that will enable http authentication only for the
+ # given strategies, for example, `config.http_authenticatable = [:database]` will
+ # enable it only for database authentication.
+ # For API-only applications to support authentication "out-of-the-box", you will likely want to
+ # enable this with :database unless you are using a custom strategy.
+ # The supported strategies are:
+ # :database = Support basic authentication with authentication key + password
+ # config.http_authenticatable = false
+
+ # If 401 status code should be returned for AJAX requests. True by default.
+ # config.http_authenticatable_on_xhr = true
+
+ # The realm used in Http Basic Authentication. 'Application' by default.
+ # config.http_authentication_realm = 'Application'
+
+ # It will change confirmation, password recovery and other workflows
+ # to behave the same regardless if the e-mail provided was right or wrong.
+ # Does not affect registerable.
+ # config.paranoid = true
+
+ # By default Devise will store the user in session. You can skip storage for
+ # particular strategies by setting this option.
+ # Notice that if you are skipping storage for all authentication paths, you
+ # may want to disable generating routes to Devise's sessions controller by
+ # passing skip: :sessions to `devise_for` in your config/routes.rb
+ config.skip_session_storage = [:http_auth]
+
+ # By default, Devise cleans up the CSRF token on authentication to
+ # avoid CSRF token fixation attacks. This means that, when using AJAX
+ # requests for sign in and sign up, you need to get a new CSRF token
+ # from the server. You can disable this option at your own risk.
+ # config.clean_up_csrf_token_on_authentication = true
+
+ # When false, Devise will not attempt to reload routes on eager load.
+ # This can reduce the time taken to boot the app but if your application
+ # requires the Devise mappings to be loaded during boot time the application
+ # won't boot properly.
+ # config.reload_routes = true
+
+ # ==> Configuration for :database_authenticatable
+ # For bcrypt, this is the cost for hashing the password and defaults to 12. If
+ # using other algorithms, it sets how many times you want the password to be hashed.
+ # The number of stretches used for generating the hashed password are stored
+ # with the hashed password. This allows you to change the stretches without
+ # invalidating existing passwords.
+ #
+ # Limiting the stretches to just one in testing will increase the performance of
+ # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
+ # a value less than 10 in other environments. Note that, for bcrypt (the default
+ # algorithm), the cost increases exponentially with the number of stretches (e.g.
+ # a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation).
+ config.stretches = Rails.env.test? ? 1 : 12
+
+ # Set up a pepper to generate the hashed password.
+ # config.pepper = '8f2c55716f252d2f97438b3ee69cbf1cc5ef30257450a833b5adf8ea6d00af5f7d3c9f12eac247d859cef3e37c657ab76086d19787ff80e72fafe289f7dcc906'
+
+ # Send a notification to the original email when the user's email is changed.
+ # config.send_email_changed_notification = false
+
+ # Send a notification email when the user's password is changed.
+ # config.send_password_change_notification = false
+
+ # ==> Configuration for :confirmable
+ # A period that the user is allowed to access the website even without
+ # confirming their account. For instance, if set to 2.days, the user will be
+ # able to access the website for two days without confirming their account,
+ # access will be blocked just in the third day.
+ # You can also set it to nil, which will allow the user to access the website
+ # without confirming their account.
+ # Default is 0.days, meaning the user cannot access the website without
+ # confirming their account.
+ # config.allow_unconfirmed_access_for = 2.days
+
+ # A period that the user is allowed to confirm their account before their
+ # token becomes invalid. For example, if set to 3.days, the user can confirm
+ # their account within 3 days after the mail was sent, but on the fourth day
+ # their account can't be confirmed with the token any more.
+ # Default is nil, meaning there is no restriction on how long a user can take
+ # before confirming their account.
+ # config.confirm_within = 3.days
+
+ # If true, requires any email changes to be confirmed (exactly the same way as
+ # initial account confirmation) to be applied. Requires additional unconfirmed_email
+ # db field (see migrations). Until confirmed, new email is stored in
+ # unconfirmed_email column, and copied to email column on successful confirmation.
+ # Also, when used in conjunction with `send_email_changed_notification`,
+ # the notification is sent to the original email when the change is requested,
+ # not when the unconfirmed email is confirmed.
+ config.reconfirmable = true
+
+ # Defines which key will be used when confirming an account
+ # config.confirmation_keys = [:email]
+
+ # ==> Configuration for :rememberable
+ # The time the user will be remembered without asking for credentials again.
+ # config.remember_for = 2.weeks
+
+ # Invalidates all the remember me tokens when the user signs out.
+ config.expire_all_remember_me_on_sign_out = true
+
+ # If true, extends the user's remember period when remembered via cookie.
+ # config.extend_remember_period = false
+
+ # Options to be passed to the created cookie. For instance, you can set
+ # secure: true in order to force SSL only cookies.
+ # config.rememberable_options = {}
+
+ # ==> Configuration for :validatable
+ # Range for password length.
+ config.password_length = 6..128
+
+ # Email regex used to validate email formats. It simply asserts that
+ # one (and only one) @ exists in the given string. This is mainly
+ # to give user feedback and not to assert the e-mail validity.
+ config.email_regexp = /\A[^@\s]+@[^@\s]+\z/
+
+ # ==> Configuration for :timeoutable
+ # The time you want to timeout the user session without activity. After this
+ # time the user will be asked for credentials again. Default is 30 minutes.
+ # config.timeout_in = 30.minutes
+
+ # ==> Configuration for :lockable
+ # Defines which strategy will be used to lock an account.
+ # :failed_attempts = Locks an account after a number of failed attempts to sign in.
+ # :none = No lock strategy. You should handle locking by yourself.
+ # config.lock_strategy = :failed_attempts
+
+ # Defines which key will be used when locking and unlocking an account
+ # config.unlock_keys = [:email]
+
+ # Defines which strategy will be used to unlock an account.
+ # :email = Sends an unlock link to the user email
+ # :time = Re-enables login after a certain amount of time (see :unlock_in below)
+ # :both = Enables both strategies
+ # :none = No unlock strategy. You should handle unlocking by yourself.
+ # config.unlock_strategy = :both
+
+ # Number of authentication tries before locking an account if lock_strategy
+ # is failed attempts.
+ # config.maximum_attempts = 20
+
+ # Time interval to unlock the account if :time is enabled as unlock_strategy.
+ # config.unlock_in = 1.hour
+
+ # Warn on the last attempt before the account is locked.
+ # config.last_attempt_warning = true
+
+ # ==> Configuration for :recoverable
+ #
+ # Defines which key will be used when recovering the password for an account
+ # config.reset_password_keys = [:email]
+
+ # Time interval you can reset your password with a reset password key.
+ # Don't put a too small interval or your users won't have the time to
+ # change their passwords.
+ config.reset_password_within = 6.hours
+
+ # When set to false, does not sign a user in automatically after their password is
+ # reset. Defaults to true, so a user is signed in automatically after a reset.
+ # config.sign_in_after_reset_password = true
+
+ # ==> Configuration for :encryptable
+ # Allow you to use another hashing or encryption algorithm besides bcrypt (default).
+ # You can use :sha1, :sha512 or algorithms from others authentication tools as
+ # :clearance_sha1, :authlogic_sha512 (then you should set stretches above to 20
+ # for default behavior) and :restful_authentication_sha1 (then you should set
+ # stretches to 10, and copy REST_AUTH_SITE_KEY to pepper).
+ #
+ # Require the `devise-encryptable` gem when using anything other than bcrypt
+ # config.encryptor = :sha512
+
+ # ==> Scopes configuration
+ # Turn scoped views on. Before rendering "sessions/new", it will first check for
+ # "users/sessions/new". It's turned off by default because it's slower if you
+ # are using only default views.
+ # config.scoped_views = false
+
+ # Configure the default scope given to Warden. By default it's the first
+ # devise role declared in your routes (usually :user).
+ # config.default_scope = :user
+
+ # Set this configuration to false if you want /users/sign_out to sign out
+ # only the current scope. By default, Devise signs out all scopes.
+ # config.sign_out_all_scopes = true
+
+ # ==> Navigation configuration
+ # Lists the formats that should be treated as navigational. Formats like
+ # :html should redirect to the sign in page when the user does not have
+ # access, but formats like :xml or :json, should return 401.
+ #
+ # If you have any extra navigational formats, like :iphone or :mobile, you
+ # should add them to the navigational formats lists.
+ #
+ # The "*/*" below is required to match Internet Explorer requests.
+ # config.navigational_formats = ['*/*', :html, :turbo_stream]
+
+ # The default HTTP method used to sign out a resource. Default is :delete.
+ config.sign_out_via = :delete
+
+ # ==> OmniAuth
+ # Add a new OmniAuth provider. Check the wiki for more information on setting
+ # up on your models and hooks.
+ # config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo'
+
+ # ==> Warden configuration
+ # If you want to use other strategies, that are not supported by Devise, or
+ # change the failure app, you can configure them inside the config.warden block.
+ #
+ # config.warden do |warden_config|
+ # warden_config.intercept_401 = false
+ # warden_config.default_strategies(scope: :user).unshift :some_external_strategy
+ # end
+
+ # ==> Mountable engine configurations
+ # When using Devise inside an engine, let's call it `MyEngine`, and this engine
+ # is mountable, there are some extra configurations to be taken into account.
+ # The following options are available, assuming the engine is mounted as:
+ #
+ # mount MyEngine, at: '/my_engine'
+ #
+ # The router that invoked `devise_for`, in the example above, would be:
+ # config.router_name = :my_engine
+ #
+ # When using OmniAuth, Devise cannot automatically set OmniAuth path,
+ # so you need to do it manually. For the users scope, it would be:
+ # config.omniauth_path_prefix = '/my_engine/users/auth'
+
+ # ==> Hotwire/Turbo configuration
+ # When using Devise with Hotwire/Turbo, the http status for error responses
+ # and some redirects must match the following. The default in Devise for existing
+ # apps is `200 OK` and `302 Found` respectively, but new apps are generated with
+ # these new defaults that match Hotwire/Turbo behavior.
+ # Note: These might become the new default in future versions of Devise.
+ config.responder.error_status = :unprocessable_content
+ config.responder.redirect_status = :see_other
+
+ # ==> Configuration for :registerable
+
+ # When set to false, does not sign a user in automatically after their password is
+ # changed. Defaults to true, so a user is signed in automatically after changing a password.
+ # config.sign_in_after_change_password = true
+end
diff --git a/backend/config/initializers/spree.rb b/backend/config/initializers/spree.rb
new file mode 100644
index 0000000000..9ca9f751ef
--- /dev/null
+++ b/backend/config/initializers/spree.rb
@@ -0,0 +1,125 @@
+# Configure Spree Preferences
+#
+# Note: Initializing preferences available within the Admin will overwrite any changes that were made through the user interface when you restart.
+# If you would like users to be able to update a setting with the Admin it should NOT be set here.
+#
+# Note: If a preference is set here it will be stored within the cache & database upon initialization.
+# Just removing an entry from this initializer will not make the preference value go away.
+# Instead you must either set a new value or remove entry, clear cache, and remove database entry.
+#
+# In order to initialize a setting do:
+# config.setting_name = 'new value'
+#
+# More on configuring Spree preferences can be found at:
+# https://docs.spreecommerce.org/developer/customization
+Spree.config do |config|
+ # Example:
+ # Uncomment to stop tracking inventory levels in the application
+ # config.track_inventory_levels = false
+end
+
+# Background job queue names
+# Spree.queues.default = :default
+# Spree.queues.events = :default # Event subscribers (Spree::Events::SubscriberJob)
+# Spree.queues.variants = :default
+# Spree.queues.stock_location_stock_items = :default
+# Spree.queues.coupon_codes = :default
+
+# Use a CDN host for images, eg. Cloudfront
+# This is used in the frontend to generate absolute URLs to images
+# Default is nil and your application host will be used
+# Spree.cdn_host = 'cdn.example.com'
+
+# Multi-store setup
+# You need to set a wildcard `root_domain` on the store to enable multi-store setup
+# all new stores will be created in a subdomain of the root domain, eg. store1.lvh.me, store2.lvh.me, etc.
+# Spree.root_domain = ENV.fetch('SPREE_ROOT_DOMAIN', 'lvh.me')
+
+# Use a different service for storage (S3, google, etc)
+# unless Rails.env.test?
+# Spree.private_storage_service_name = :amazon_public # public assets, such as product images
+# Spree.public_storage_service_name = :amazon_private # private assets, such as invoices, etc
+# end
+
+# Enable theme preview screenshots in admin dashboard
+# Spree.screenshot_api_token = <Your Screenshot API token obtained from https://screenshotapi.net/>
+
+# Configure Spree Dependencies
+#
+# Note: If a dependency is set here it will NOT be stored within the cache & database upon initialization.
+# Just removing an entry from this initializer will make the dependency value go away.
+#
+# More on how to use Spree dependencies can be found at:
+# https://docs.spreecommerce.org/customization/dependencies
+Spree.dependencies do |dependencies|
+ # Example:
+ # Uncomment to change the default Service handling adding Items to Cart
+ # dependencies.cart_add_item_service = 'MyNewAwesomeService'
+end
+
+# Spree::Api::Dependencies.storefront_cart_serializer = 'MyRailsApp::CartSerializer'
+
+# uncomment lines below to add your own custom business logic
+# such as promotions, shipping methods, etc
+Rails.application.config.after_initialize do
+ # Payment methods and shipping calculators
+ # Spree.payment_methods << Spree::PaymentMethods::VerySafeAndReliablePaymentMethod
+ # Spree.calculators.shipping_methods << Spree::ShippingMethods::SuperExpensiveNotVeryFastShipping
+ # Spree.calculators.tax_rates << Spree::TaxRates::FinanceTeamForcedMeToCodeThis
+
+ # Stock splitters and adjusters
+ # Spree.stock_splitters << Spree::Stock::Splitters::SecretLogicSplitter
+ # Spree.adjusters << Spree::Adjustable::Adjuster::TaxTheRich
+
+ # Custom promotions
+ # Spree.calculators.promotion_actions_create_adjustments << Spree::Calculators::PromotionActions::CreateAdjustments::AddDiscountForFriends
+ # Spree.calculators.promotion_actions_create_item_adjustments << Spree::Calculators::PromotionActions::CreateItemAdjustments::FinanceTeamForcedMeToCodeThis
+ # Spree.promotions.rules << Spree::Promotions::Rules::OnlyForVIPCustomers
+ # Spree.promotions.actions << Spree::Promotions::Actions::GiftWithPurchase
+
+ # Taxon rules
+ # Spree.taxon_rules << Spree::TaxonRules::ProductsWithColor
+
+ # Exports and reports
+ # Spree.export_types << Spree::Exports::Payments
+ # Spree.reports << Spree::Reports::MassivelyOvercomplexReportForCfo
+
+ # Admin partials
+ # Spree.admin.partials.product_form << 'spree/admin/products/custom_section'
+
+ # Role-based permissions
+ # Configure which permission sets are assigned to each role
+ # More on permission sets: https://spreecommerce.org/docs/developer/customization/permissions
+ Spree.permissions.assign(:default, [Spree::PermissionSets::DefaultCustomer])
+ Spree.permissions.assign(:admin, [Spree::PermissionSets::SuperUser])
+
+ # Example: Create a custom role with specific permissions
+ # Spree.permissions.assign(:customer_service, [
+ # Spree::PermissionSets::DashboardDisplay,
+ # Spree::PermissionSets::OrderManagement,
+ # Spree::PermissionSets::UserDisplay
+ # ])
+ #
+ # Available permission sets:
+ # - Spree::PermissionSets::SuperUser (full admin access)
+ # - Spree::PermissionSets::DefaultCustomer (storefront access)
+ # - Spree::PermissionSets::DashboardDisplay (view admin dashboard)
+ # - Spree::PermissionSets::OrderDisplay / OrderManagement
+ # - Spree::PermissionSets::ProductDisplay / ProductManagement
+ # - Spree::PermissionSets::UserDisplay / UserManagement
+ # - Spree::PermissionSets::StockDisplay / StockManagement
+ # - Spree::PermissionSets::PromotionManagement
+ # - Spree::PermissionSets::ConfigurationManagement
+ # - Spree::PermissionSets::RoleManagement
+end
+
+Spree.user_class = "Spree::User"
+Spree.admin_user_class = "Spree::AdminUser"
+
+ Rails.application.config.to_prepare do
+ require_dependency 'spree/authentication_helpers'
+ end
+
+ if defined?(Devise) && Devise.respond_to?(:parent_controller)
+ Devise.parent_controller = "Spree::BaseController"
+ end
diff --git a/backend/config/locales/devise.en.yml b/backend/config/locales/devise.en.yml
new file mode 100644
index 0000000000..260e1c4ba6
--- /dev/null
+++ b/backend/config/locales/devise.en.yml
@@ -0,0 +1,65 @@
+# Additional translations at https://github.com/heartcombo/devise/wiki/I18n
+
+en:
+ devise:
+ confirmations:
+ confirmed: "Your email address has been successfully confirmed."
+ send_instructions: "You will receive an email with instructions for how to confirm your email address in a few minutes."
+ send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions for how to confirm your email address in a few minutes."
+ failure:
+ already_authenticated: "You are already signed in."
+ inactive: "Your account is not activated yet."
+ invalid: "Invalid %{authentication_keys} or password."
+ locked: "Your account is locked."
+ last_attempt: "You have one more attempt before your account is locked."
+ not_found_in_database: "Invalid %{authentication_keys} or password."
+ timeout: "Your session expired. Please sign in again to continue."
+ unauthenticated: "You need to sign in or sign up before continuing."
+ unconfirmed: "You have to confirm your email address before continuing."
+ mailer:
+ confirmation_instructions:
+ subject: "Confirmation instructions"
+ reset_password_instructions:
+ subject: "Reset password instructions"
+ unlock_instructions:
+ subject: "Unlock instructions"
+ email_changed:
+ subject: "Email Changed"
+ password_change:
+ subject: "Password Changed"
+ omniauth_callbacks:
+ failure: "Could not authenticate you from %{kind} because \"%{reason}\"."
+ success: "Successfully authenticated from %{kind} account."
+ passwords:
+ no_token: "You can't access this page without coming from a password reset email. If you do come from a password reset email, please make sure you used the full URL provided."
+ send_instructions: "You will receive an email with instructions on how to reset your password in a few minutes."
+ send_paranoid_instructions: "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes."
+ updated: "Your password has been changed successfully. You are now signed in."
+ updated_not_active: "Your password has been changed successfully."
+ registrations:
+ destroyed: "Bye! Your account has been successfully cancelled. We hope to see you again soon."
+ signed_up: "Welcome! You have signed up successfully."
+ signed_up_but_inactive: "You have signed up successfully. However, we could not sign you in because your account is not yet activated."
+ signed_up_but_locked: "You have signed up successfully. However, we could not sign you in because your account is locked."
+ signed_up_but_unconfirmed: "A message with a confirmation link has been sent to your email address. Please follow the link to activate your account."
+ update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and follow the confirmation link to confirm your new email address."
+ updated: "Your account has been updated successfully."
+ updated_but_not_signed_in: "Your account has been updated successfully, but since your password was changed, you need to sign in again."
+ sessions:
+ signed_in: "Signed in successfully."
+ signed_out: "Signed out successfully."
+ already_signed_out: "Signed out successfully."
+ unlocks:
+ send_instructions: "You will receive an email with instructions for how to unlock your account in a few minutes."
+ send_paranoid_instructions: "If your account exists, you will receive an email with instructions for how to unlock it in a few minutes."
+ unlocked: "Your account has been unlocked successfully. Please sign in to continue."
+ errors:
+ messages:
+ already_confirmed: "was already confirmed, please try signing in"
+ confirmation_period_expired: "needs to be confirmed within %{period}, please request a new one"
+ expired: "has expired, please request a new one"
+ not_found: "not found"
+ not_locked: "was not locked"
+ not_saved:
+ one: "1 error prohibited this %{resource} from being saved:"
+ other: "%{count} errors prohibited this %{resource} from being saved:"
diff --git a/backend/config/routes.rb b/backend/config/routes.rb
index 48254e88ed..b875c22b96 100644
--- a/backend/config/routes.rb
+++ b/backend/config/routes.rb
@@ -1,4 +1,29 @@
Rails.application.routes.draw do
+ Spree::Core::Engine.add_routes do
+ # Admin authentication
+ devise_for(
+ Spree.admin_user_class.model_name.singular_route_key,
+ class_name: Spree.admin_user_class.to_s,
+ controllers: {
+ sessions: 'spree/admin/user_sessions',
+ passwords: 'spree/admin/user_passwords'
+ },
+ skip: :registrations,
+ path: :admin_user,
+ router_name: :spree
+ )
+ end
+ # This line mounts Spree's routes at the root of your application.
+ # This means, any requests to URLs such as /products, will go to
+ # Spree::ProductsController.
+ # If you would like to change where this engine is mounted, simply change the
+ # :at option to something different.
+ #
+ # We ask that you don't use the :as option here, as Spree relies on it being
+ # the default of "spree".
+ mount Spree::Core::Engine, at: '/'
+ devise_for :admin_users, class_name: "Spree::AdminUser"
+ devise_for :users, class_name: "Spree::User"
# Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html
# Reveal health status on /up that returns 200 if the app boots with no exceptions, otherwise 500.
diff --git a/backend/db/migrate/20260209133510_devise_create_spree_users.rb b/backend/db/migrate/20260209133510_devise_create_spree_users.rb
new file mode 100644
index 0000000000..d25ce4342c
--- /dev/null
+++ b/backend/db/migrate/20260209133510_devise_create_spree_users.rb
@@ -0,0 +1,44 @@
+# frozen_string_literal: true
+
+class DeviseCreateSpreeUsers < ActiveRecord::Migration[8.1]
+ 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/backend/db/migrate/20260209133512_devise_create_spree_admin_users.rb b/backend/db/migrate/20260209133512_devise_create_spree_admin_users.rb
new file mode 100644
index 0000000000..5f9e4f6229
--- /dev/null
+++ b/backend/db/migrate/20260209133512_devise_create_spree_admin_users.rb
@@ -0,0 +1,44 @@
+# frozen_string_literal: true
+
+class DeviseCreateSpreeAdminUsers < ActiveRecord::Migration[8.1]
+ 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/backend/db/migrate/20260209133519_create_active_storage_tables.active_storage.rb b/backend/db/migrate/20260209133519_create_active_storage_tables.active_storage.rb
new file mode 100644
index 0000000000..6bd8bd082a
--- /dev/null
+++ b/backend/db/migrate/20260209133519_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/backend/db/migrate/20260209133521_create_action_text_tables.action_text.rb b/backend/db/migrate/20260209133521_create_action_text_tables.action_text.rb
new file mode 100644
index 0000000000..c1c0a9d8cc
--- /dev/null
+++ b/backend/db/migrate/20260209133521_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/backend/db/migrate/20260209133522_spree_four_three.spree.rb b/backend/db/migrate/20260209133522_spree_four_three.spree.rb
new file mode 100644
index 0000000000..5746b1242d
--- /dev/null
+++ b/backend/db/migrate/20260209133522_spree_four_three.spree.rb
@@ -0,0 +1,1127 @@
+# 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_product_properties", force: :cascade do |t|
+ t.string "value"
+ t.bigint "product_id"
+ t.bigint "property_id"
+ t.datetime "created_at", precision: 6, null: false
+ t.datetime "updated_at", precision: 6, null: false
+ t.integer "position", default: 0
+ t.boolean "show_property", default: true
+ t.string "filter_param"
+ t.index ["filter_param"], name: "index_spree_product_properties_on_filter_param"
+ t.index ["position"], name: "index_spree_product_properties_on_position"
+ t.index ["product_id"], name: "index_product_properties_on_product_id"
+ t.index ["property_id", "product_id"], name: "index_spree_product_properties_on_property_id_and_product_id", unique: true
+ t.index ["property_id"], name: "index_spree_product_properties_on_property_id"
+ 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_properties", force: :cascade do |t|
+ t.string "name"
+ t.string "presentation", null: false
+ t.datetime "created_at", precision: 6, null: false
+ t.datetime "updated_at", precision: 6, null: false
+ t.boolean "filterable", default: false, null: false
+ t.string "filter_param"
+ t.index ["filter_param"], name: "index_spree_properties_on_filter_param"
+ t.index ["filterable"], name: "index_spree_properties_on_filterable"
+ t.index ["name"], name: "index_spree_properties_on_name"
+ end
+
+ create_table "spree_property_prototypes", force: :cascade do |t|
+ t.bigint "prototype_id"
+ t.bigint "property_id"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ t.index ["property_id"], name: "index_spree_property_prototypes_on_property_id"
+ t.index ["prototype_id", "property_id"], name: "index_property_prototypes_on_prototype_id_and_property_id", unique: true
+ t.index ["prototype_id"], name: "index_spree_property_prototypes_on_prototype_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/backend/db/migrate/20260209133523_add_metadata_to_spree_orders.spree.rb b/backend/db/migrate/20260209133523_add_metadata_to_spree_orders.spree.rb
new file mode 100644
index 0000000000..52d4e34f7f
--- /dev/null
+++ b/backend/db/migrate/20260209133523_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/backend/db/migrate/20260209133524_add_metadata_to_spree_products.spree.rb b/backend/db/migrate/20260209133524_add_metadata_to_spree_products.spree.rb
new file mode 100644
index 0000000000..f536e3cf59
--- /dev/null
+++ b/backend/db/migrate/20260209133524_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/backend/db/migrate/20260209133525_add_metadata_to_spree_variants.spree.rb b/backend/db/migrate/20260209133525_add_metadata_to_spree_variants.spree.rb
new file mode 100644
index 0000000000..6db507fe13
--- /dev/null
+++ b/backend/db/migrate/20260209133525_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/backend/db/migrate/20260209133526_add_metadata_to_spree_line_items.spree.rb b/backend/db/migrate/20260209133526_add_metadata_to_spree_line_items.spree.rb
new file mode 100644
index 0000000000..86103f6ae8
--- /dev/null
+++ b/backend/db/migrate/20260209133526_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/backend/db/migrate/20260209133527_add_metadata_to_spree_shipments.spree.rb b/backend/db/migrate/20260209133527_add_metadata_to_spree_shipments.spree.rb
new file mode 100644
index 0000000000..e56973b801
--- /dev/null
+++ b/backend/db/migrate/20260209133527_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/backend/db/migrate/20260209133528_add_metadata_to_spree_payments.spree.rb b/backend/db/migrate/20260209133528_add_metadata_to_spree_payments.spree.rb
new file mode 100644
index 0000000000..42dd39d59c
--- /dev/null
+++ b/backend/db/migrate/20260209133528_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/backend/db/migrate/20260209133529_add_metadata_to_spree_taxons_and_taxonomies.spree.rb b/backend/db/migrate/20260209133529_add_metadata_to_spree_taxons_and_taxonomies.spree.rb
new file mode 100644
index 0000000000..efa9153ffe
--- /dev/null
+++ b/backend/db/migrate/20260209133529_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/backend/db/migrate/20260209133530_add_metadata_to_spree_stock_transfers.spree.rb b/backend/db/migrate/20260209133530_add_metadata_to_spree_stock_transfers.spree.rb
new file mode 100644
index 0000000000..3143291d92
--- /dev/null
+++ b/backend/db/migrate/20260209133530_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/backend/db/migrate/20260209133531_add_metadata_to_spree_multiple_tables.spree.rb b/backend/db/migrate/20260209133531_add_metadata_to_spree_multiple_tables.spree.rb
new file mode 100644
index 0000000000..732328db06
--- /dev/null
+++ b/backend/db/migrate/20260209133531_add_metadata_to_spree_multiple_tables.spree.rb
@@ -0,0 +1,31 @@
+# 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_properties
+ 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/backend/db/migrate/20260209133532_add_deleted_at_to_spree_stores.spree.rb b/backend/db/migrate/20260209133532_add_deleted_at_to_spree_stores.spree.rb
new file mode 100644
index 0000000000..5ee5ac0bec
--- /dev/null
+++ b/backend/db/migrate/20260209133532_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/backend/db/migrate/20260209133533_rename_column_access_hash_to_token.spree.rb b/backend/db/migrate/20260209133533_rename_column_access_hash_to_token.spree.rb
new file mode 100644
index 0000000000..44d49c91f5
--- /dev/null
+++ b/backend/db/migrate/20260209133533_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/backend/db/migrate/20260209133534_create_spree_wishlists.spree.rb b/backend/db/migrate/20260209133534_create_spree_wishlists.spree.rb
new file mode 100644
index 0000000000..a84edd9012
--- /dev/null
+++ b/backend/db/migrate/20260209133534_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/backend/db/migrate/20260209133535_create_spree_wished_products.spree.rb b/backend/db/migrate/20260209133535_create_spree_wished_products.spree.rb
new file mode 100644
index 0000000000..5811a48691
--- /dev/null
+++ b/backend/db/migrate/20260209133535_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/backend/db/migrate/20260209133536_rename_spree_wished_products_to_spree_wished_items.spree.rb b/backend/db/migrate/20260209133536_rename_spree_wished_products_to_spree_wished_items.spree.rb
new file mode 100644
index 0000000000..a38e49880b
--- /dev/null
+++ b/backend/db/migrate/20260209133536_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/backend/db/migrate/20260209133537_add_unique_stock_item_stock_location_variant_deleted_at_index.spree.rb b/backend/db/migrate/20260209133537_add_unique_stock_item_stock_location_variant_deleted_at_index.spree.rb
new file mode 100644
index 0000000000..24337f56c8
--- /dev/null
+++ b/backend/db/migrate/20260209133537_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/backend/db/migrate/20260209133538_create_stock_item_stock_location_id_variant_id_coalesce_deleted_at_unique_index.spree.rb b/backend/db/migrate/20260209133538_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/backend/db/migrate/20260209133538_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/backend/db/migrate/20260209133539_create_spree_digital_links.spree.rb b/backend/db/migrate/20260209133539_create_spree_digital_links.spree.rb
new file mode 100644
index 0000000000..2340667be3
--- /dev/null
+++ b/backend/db/migrate/20260209133539_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/backend/db/migrate/20260209133540_create_spree_digitals.spree.rb b/backend/db/migrate/20260209133540_create_spree_digitals.spree.rb
new file mode 100644
index 0000000000..f6ae40b0e8
--- /dev/null
+++ b/backend/db/migrate/20260209133540_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/backend/db/migrate/20260209133541_rename_secret_to_token_on_spree_digital_links.spree.rb b/backend/db/migrate/20260209133541_rename_secret_to_token_on_spree_digital_links.spree.rb
new file mode 100644
index 0000000000..7c42f776a7
--- /dev/null
+++ b/backend/db/migrate/20260209133541_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/backend/db/migrate/20260209133542_add_settings_to_spree_stores.spree.rb b/backend/db/migrate/20260209133542_add_settings_to_spree_stores.spree.rb
new file mode 100644
index 0000000000..1dcb13f025
--- /dev/null
+++ b/backend/db/migrate/20260209133542_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/backend/db/migrate/20260209133543_add_settings_to_payment_methods.spree.rb b/backend/db/migrate/20260209133543_add_settings_to_payment_methods.spree.rb
new file mode 100644
index 0000000000..5c68a97827
--- /dev/null
+++ b/backend/db/migrate/20260209133543_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/backend/db/migrate/20260209133544_disable_propagate_all_variants_by_default.spree.rb b/backend/db/migrate/20260209133544_disable_propagate_all_variants_by_default.spree.rb
new file mode 100644
index 0000000000..f8593808fc
--- /dev/null
+++ b/backend/db/migrate/20260209133544_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/backend/db/migrate/20260209133545_add_status_and_make_active_at_to_spree_products.spree.rb b/backend/db/migrate/20260209133545_add_status_and_make_active_at_to_spree_products.spree.rb
new file mode 100644
index 0000000000..763beb2797
--- /dev/null
+++ b/backend/db/migrate/20260209133545_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/backend/db/migrate/20260209133546_add_internal_note_to_spree_orders.spree.rb b/backend/db/migrate/20260209133546_add_internal_note_to_spree_orders.spree.rb
new file mode 100644
index 0000000000..1efb621e47
--- /dev/null
+++ b/backend/db/migrate/20260209133546_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/backend/db/migrate/20260209133547_create_payment_sources.spree.rb b/backend/db/migrate/20260209133547_create_payment_sources.spree.rb
new file mode 100644
index 0000000000..5b7322b409
--- /dev/null
+++ b/backend/db/migrate/20260209133547_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/backend/db/migrate/20260209133548_add_make_active_at_to_spree_products.spree.rb b/backend/db/migrate/20260209133548_add_make_active_at_to_spree_products.spree.rb
new file mode 100644
index 0000000000..c841893913
--- /dev/null
+++ b/backend/db/migrate/20260209133548_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/backend/db/migrate/20260209133549_add_metadata_to_spree_tax_rates.spree.rb b/backend/db/migrate/20260209133549_add_metadata_to_spree_tax_rates.spree.rb
new file mode 100644
index 0000000000..eed16c0d83
--- /dev/null
+++ b/backend/db/migrate/20260209133549_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/backend/db/migrate/20260209133550_add_first_name_and_last_name_to_spree_users.spree.rb b/backend/db/migrate/20260209133550_add_first_name_and_last_name_to_spree_users.spree.rb
new file mode 100644
index 0000000000..33151ad2a3
--- /dev/null
+++ b/backend/db/migrate/20260209133550_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/backend/db/migrate/20260209133551_add_barcode_to_spree_variants.spree.rb b/backend/db/migrate/20260209133551_add_barcode_to_spree_variants.spree.rb
new file mode 100644
index 0000000000..ab7c464795
--- /dev/null
+++ b/backend/db/migrate/20260209133551_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/backend/db/migrate/20260209133552_add_metadata_to_spree_stock_items.spree.rb b/backend/db/migrate/20260209133552_add_metadata_to_spree_stock_items.spree.rb
new file mode 100644
index 0000000000..3a6c6507c9
--- /dev/null
+++ b/backend/db/migrate/20260209133552_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/backend/db/migrate/20260209133553_create_product_name_and_description_translations_for_mobility_table_backend.spree.rb b/backend/db/migrate/20260209133553_create_product_name_and_description_translations_for_mobility_table_backend.spree.rb
new file mode 100644
index 0000000000..da045d68b1
--- /dev/null
+++ b/backend/db/migrate/20260209133553_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/backend/db/migrate/20260209133554_create_spree_product_translations_for_mobility.spree.rb b/backend/db/migrate/20260209133554_create_spree_product_translations_for_mobility.spree.rb
new file mode 100644
index 0000000000..d6de3a34e6
--- /dev/null
+++ b/backend/db/migrate/20260209133554_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/backend/db/migrate/20260209133555_create_spree_taxon_name_and_description_translations_for_mobility_table_backend.spree.rb b/backend/db/migrate/20260209133555_create_spree_taxon_name_and_description_translations_for_mobility_table_backend.spree.rb
new file mode 100644
index 0000000000..ef48a1d6b8
--- /dev/null
+++ b/backend/db/migrate/20260209133555_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/backend/db/migrate/20260209133556_add_locale_to_friendly_id_slugs.spree.rb b/backend/db/migrate/20260209133556_add_locale_to_friendly_id_slugs.spree.rb
new file mode 100644
index 0000000000..fad7ed6def
--- /dev/null
+++ b/backend/db/migrate/20260209133556_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/backend/db/migrate/20260209133557_create_spree_product_slug_translations_for_mobility_table_backend.spree.rb b/backend/db/migrate/20260209133557_create_spree_product_slug_translations_for_mobility_table_backend.spree.rb
new file mode 100644
index 0000000000..ba7afce613
--- /dev/null
+++ b/backend/db/migrate/20260209133557_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/backend/db/migrate/20260209133558_add_selected_locale_to_spree_users.spree.rb b/backend/db/migrate/20260209133558_add_selected_locale_to_spree_users.spree.rb
new file mode 100644
index 0000000000..c97a24793b
--- /dev/null
+++ b/backend/db/migrate/20260209133558_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/backend/db/migrate/20260209133559_add_deleted_at_to_product_translations.spree.rb b/backend/db/migrate/20260209133559_add_deleted_at_to_product_translations.spree.rb
new file mode 100644
index 0000000000..d1735264e9
--- /dev/null
+++ b/backend/db/migrate/20260209133559_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/backend/db/migrate/20260209133560_add_uniqueness_constraint_to_product_translations.spree.rb b/backend/db/migrate/20260209133560_add_uniqueness_constraint_to_product_translations.spree.rb
new file mode 100644
index 0000000000..cce1f04493
--- /dev/null
+++ b/backend/db/migrate/20260209133560_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/backend/db/migrate/20260209133561_create_spree_data_feed_settings.spree.rb b/backend/db/migrate/20260209133561_create_spree_data_feed_settings.spree.rb
new file mode 100644
index 0000000000..1d67237a8d
--- /dev/null
+++ b/backend/db/migrate/20260209133561_create_spree_data_feed_settings.spree.rb
@@ -0,0 +1,15 @@
+# This migration comes from spree (originally 20221229132350)
+class CreateSpreeDataFeedSettings < ActiveRecord::Migration[6.0]
+ def change
+ create_table :spree_data_feed_settings do |t|
+ t.references :spree_store
+
+ t.string :name
+ t.string :provider
+ t.string :uuid, unique: true
+ t.boolean :enabled, default: true
+
+ t.timestamps
+ end
+ end
+end
diff --git a/backend/db/migrate/20260209133562_create_option_type_translations.spree.rb b/backend/db/migrate/20260209133562_create_option_type_translations.spree.rb
new file mode 100644
index 0000000000..89c06ef74a
--- /dev/null
+++ b/backend/db/migrate/20260209133562_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/backend/db/migrate/20260209133563_create_option_value_translations.spree.rb b/backend/db/migrate/20260209133563_create_option_value_translations.spree.rb
new file mode 100644
index 0000000000..11fc495224
--- /dev/null
+++ b/backend/db/migrate/20260209133563_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/backend/db/migrate/20260209133564_create_product_property_translations.spree.rb b/backend/db/migrate/20260209133564_create_product_property_translations.spree.rb
new file mode 100644
index 0000000000..e5869f97ea
--- /dev/null
+++ b/backend/db/migrate/20260209133564_create_product_property_translations.spree.rb
@@ -0,0 +1,25 @@
+# This migration comes from spree (originally 20230109084253)
+class CreateProductPropertyTranslations < ActiveRecord::Migration[6.1]
+ def change
+ if ActiveRecord::Base.connection.table_exists? 'spree_product_property_translations'
+ # manually check for index since Rails if_exists does not always work correctly
+ if ActiveRecord::Migration.connection.index_exists?(:spree_product_property_translations, :spree_product_property_id)
+ remove_index :spree_product_property_translations, column: :spree_product_property_id, if_exists: true
+ end
+ else
+ create_table :spree_product_property_translations do |t|
+ # Translated attribute(s)
+ t.string :value
+
+ t.string :locale, null: false
+ t.references :spree_product_property, null: false, foreign_key: true, index: false
+
+ t.timestamps
+ end
+
+ add_index :spree_product_property_translations, :locale, name: :index_spree_product_property_translations_on_locale
+ end
+
+ add_index :spree_product_property_translations, [:spree_product_property_id, :locale], name: :unique_product_property_id_per_locale, unique: true
+ end
+end
diff --git a/backend/db/migrate/20260209133565_create_property_translations.spree.rb b/backend/db/migrate/20260209133565_create_property_translations.spree.rb
new file mode 100644
index 0000000000..38e052576e
--- /dev/null
+++ b/backend/db/migrate/20260209133565_create_property_translations.spree.rb
@@ -0,0 +1,25 @@
+# This migration comes from spree (originally 20230109105943)
+class CreatePropertyTranslations < ActiveRecord::Migration[6.1]
+ def change
+ if ActiveRecord::Base.connection.table_exists?('spree_property_translations')
+ # manually check for index since Rails if_exists does not always work correctly
+ if ActiveRecord::Migration.connection.index_exists?(:spree_property_translations, :spree_property_id)
+ remove_index :spree_property_translations, column: :spree_property_id, if_exists: true
+ end
+ else
+ create_table :spree_property_translations do |t|
+ # Translated attribute(s)
+ t.string :presentation
+
+ t.string :locale, null: false
+ t.references :spree_property, null: false, foreign_key: true, index: false
+
+ t.timestamps
+ end
+
+ add_index :spree_property_translations, :locale, name: :index_spree_property_translations_on_locale
+ end
+
+ add_index :spree_property_translations, [:spree_property_id, :locale], name: :unique_property_id_per_locale, unique: true
+ end
+end
diff --git a/backend/db/migrate/20260209133566_backfill_friendly_id_slug_locale.spree.rb b/backend/db/migrate/20260209133566_backfill_friendly_id_slug_locale.spree.rb
new file mode 100644
index 0000000000..dcf2e88a11
--- /dev/null
+++ b/backend/db/migrate/20260209133566_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/backend/db/migrate/20260209133567_add_additional_taxon_translation_fields.spree.rb b/backend/db/migrate/20260209133567_add_additional_taxon_translation_fields.spree.rb
new file mode 100644
index 0000000000..4d298360b0
--- /dev/null
+++ b/backend/db/migrate/20260209133567_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/backend/db/migrate/20260209133568_create_taxonomy_translations.spree.rb b/backend/db/migrate/20260209133568_create_taxonomy_translations.spree.rb
new file mode 100644
index 0000000000..c58202d745
--- /dev/null
+++ b/backend/db/migrate/20260209133568_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/backend/db/migrate/20260209133569_create_store_translations.spree.rb b/backend/db/migrate/20260209133569_create_store_translations.spree.rb
new file mode 100644
index 0000000000..fbb3a540bd
--- /dev/null
+++ b/backend/db/migrate/20260209133569_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/backend/db/migrate/20260209133570_add_deleted_at_to_store_translations.spree.rb b/backend/db/migrate/20260209133570_add_deleted_at_to_store_translations.spree.rb
new file mode 100644
index 0000000000..975021165d
--- /dev/null
+++ b/backend/db/migrate/20260209133570_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/backend/db/migrate/20260209133571_rename_data_feed_settings_table.spree.rb b/backend/db/migrate/20260209133571_rename_data_feed_settings_table.spree.rb
new file mode 100644
index 0000000000..21df59de96
--- /dev/null
+++ b/backend/db/migrate/20260209133571_rename_data_feed_settings_table.spree.rb
@@ -0,0 +1,6 @@
+# This migration comes from spree (originally 20230415155958)
+class RenameDataFeedSettingsTable < ActiveRecord::Migration[6.1]
+ def change
+ rename_table :spree_data_feed_settings, :spree_data_feeds
+ end
+end
diff --git a/backend/db/migrate/20260209133572_rename_data_feed_table_columns.spree.rb b/backend/db/migrate/20260209133572_rename_data_feed_table_columns.spree.rb
new file mode 100644
index 0000000000..ad3ea23353
--- /dev/null
+++ b/backend/db/migrate/20260209133572_rename_data_feed_table_columns.spree.rb
@@ -0,0 +1,8 @@
+# This migration comes from spree (originally 20230415160828)
+class RenameDataFeedTableColumns < ActiveRecord::Migration[6.1]
+ def change
+ rename_column :spree_data_feeds, :spree_store_id, :store_id
+ rename_column :spree_data_feeds, :enabled, :active
+ rename_column :spree_data_feeds, :uuid, :slug
+ end
+end
diff --git a/backend/db/migrate/20260209133573_add_indexes_to_data_feeds_table.spree.rb b/backend/db/migrate/20260209133573_add_indexes_to_data_feeds_table.spree.rb
new file mode 100644
index 0000000000..82b3065b6d
--- /dev/null
+++ b/backend/db/migrate/20260209133573_add_indexes_to_data_feeds_table.spree.rb
@@ -0,0 +1,6 @@
+# This migration comes from spree (originally 20230415161226)
+class AddIndexesToDataFeedsTable < ActiveRecord::Migration[6.1]
+ def change
+ add_index :spree_data_feeds, [:store_id, :slug, :provider]
+ end
+end
diff --git a/backend/db/migrate/20260209133574_rename_data_feeds_column_provider_to_type.spree.rb b/backend/db/migrate/20260209133574_rename_data_feeds_column_provider_to_type.spree.rb
new file mode 100644
index 0000000000..913bb917a3
--- /dev/null
+++ b/backend/db/migrate/20260209133574_rename_data_feeds_column_provider_to_type.spree.rb
@@ -0,0 +1,6 @@
+# This migration comes from spree (originally 20230512094803)
+class RenameDataFeedsColumnProviderToType < ActiveRecord::Migration[6.1]
+ def change
+ rename_column :spree_data_feeds, :provider, :type
+ end
+end
diff --git a/backend/db/migrate/20260209133575_fix_spree_stock_item_unique_index.spree.rb b/backend/db/migrate/20260209133575_fix_spree_stock_item_unique_index.spree.rb
new file mode 100644
index 0000000000..9bd845bc6c
--- /dev/null
+++ b/backend/db/migrate/20260209133575_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/backend/db/migrate/20260209133576_add_weight_and_dimension_units_to_spree_variants.spree.rb b/backend/db/migrate/20260209133576_add_weight_and_dimension_units_to_spree_variants.spree.rb
new file mode 100644
index 0000000000..e7e405bf42
--- /dev/null
+++ b/backend/db/migrate/20260209133576_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/backend/db/migrate/20260209133577_add_deleted_at_to_spree_stock_locations.spree.rb b/backend/db/migrate/20260209133577_add_deleted_at_to_spree_stock_locations.spree.rb
new file mode 100644
index 0000000000..d353f3dff7
--- /dev/null
+++ b/backend/db/migrate/20260209133577_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/backend/db/migrate/20260209133578_add_refunder_to_spree_refunds.spree.rb b/backend/db/migrate/20260209133578_add_refunder_to_spree_refunds.spree.rb
new file mode 100644
index 0000000000..2ac2b5d4f5
--- /dev/null
+++ b/backend/db/migrate/20260209133578_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/backend/db/migrate/20260209133579_add_pretty_name_to_spree_taxons.spree.rb b/backend/db/migrate/20260209133579_add_pretty_name_to_spree_taxons.spree.rb
new file mode 100644
index 0000000000..72b25b9712
--- /dev/null
+++ b/backend/db/migrate/20260209133579_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/backend/db/migrate/20260209133580_change_default_value_of_spree_option_types_filterable.spree.rb b/backend/db/migrate/20260209133580_change_default_value_of_spree_option_types_filterable.spree.rb
new file mode 100644
index 0000000000..6942c2b211
--- /dev/null
+++ b/backend/db/migrate/20260209133580_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/backend/db/migrate/20260209133581_add_display_on_to_spree_properties.spree.rb b/backend/db/migrate/20260209133581_add_display_on_to_spree_properties.spree.rb
new file mode 100644
index 0000000000..d5933a8b0e
--- /dev/null
+++ b/backend/db/migrate/20260209133581_add_display_on_to_spree_properties.spree.rb
@@ -0,0 +1,6 @@
+# This migration comes from spree (originally 20240914153106)
+class AddDisplayOnToSpreeProperties < ActiveRecord::Migration[6.1]
+ def change
+ add_column :spree_properties, :display_on, :string, default: 'both', if_not_exists: true
+ end
+end
diff --git a/backend/db/migrate/20260209133582_add_position_to_spree_properties.spree.rb b/backend/db/migrate/20260209133582_add_position_to_spree_properties.spree.rb
new file mode 100644
index 0000000000..c1adad51c7
--- /dev/null
+++ b/backend/db/migrate/20260209133582_add_position_to_spree_properties.spree.rb
@@ -0,0 +1,7 @@
+# This migration comes from spree (originally 20240915144935)
+class AddPositionToSpreeProperties < ActiveRecord::Migration[6.1]
+ def change
+ add_column :spree_properties, :position, :integer, default: 0, if_not_exists: true
+ add_index :spree_properties, :position, if_not_exists: true
+ end
+end
diff --git a/backend/db/migrate/20260209133583_create_spree_coupon_codes.spree.rb b/backend/db/migrate/20260209133583_create_spree_coupon_codes.spree.rb
new file mode 100644
index 0000000000..68f20dafcb
--- /dev/null
+++ b/backend/db/migrate/20260209133583_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/backend/db/migrate/20260209133584_add_multi_code_to_spree_promotions.spree.rb b/backend/db/migrate/20260209133584_add_multi_code_to_spree_promotions.spree.rb
new file mode 100644
index 0000000000..9c631d9aad
--- /dev/null
+++ b/backend/db/migrate/20260209133584_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/backend/db/migrate/20260209133585_translate_rich_texts.spree.rb b/backend/db/migrate/20260209133585_translate_rich_texts.spree.rb
new file mode 100644
index 0000000000..5f4399bc2a
--- /dev/null
+++ b/backend/db/migrate/20260209133585_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/backend/db/migrate/20260209133586_create_spree_exports.spree.rb b/backend/db/migrate/20260209133586_create_spree_exports.spree.rb
new file mode 100644
index 0000000000..cca54a9544
--- /dev/null
+++ b/backend/db/migrate/20260209133586_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/backend/db/migrate/20260209133587_migrate_spree_promotion_rules_option_value_eligible_values.spree.rb b/backend/db/migrate/20260209133587_migrate_spree_promotion_rules_option_value_eligible_values.spree.rb
new file mode 100644
index 0000000000..e01026f620
--- /dev/null
+++ b/backend/db/migrate/20260209133587_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/backend/db/migrate/20260209133588_add_estimated_transit_fields_to_spree_shipping_methods.spree.rb b/backend/db/migrate/20260209133588_add_estimated_transit_fields_to_spree_shipping_methods.spree.rb
new file mode 100644
index 0000000000..88e1c952b1
--- /dev/null
+++ b/backend/db/migrate/20260209133588_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/backend/db/migrate/20260209133589_create_spree_taxon_rules.spree.rb b/backend/db/migrate/20260209133589_create_spree_taxon_rules.spree.rb
new file mode 100644
index 0000000000..1ed36d6364
--- /dev/null
+++ b/backend/db/migrate/20260209133589_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/backend/db/migrate/20260209133590_add_rules_match_policy_and_sort_order_to_spree_taxons.spree.rb b/backend/db/migrate/20260209133590_add_rules_match_policy_and_sort_order_to_spree_taxons.spree.rb
new file mode 100644
index 0000000000..11a8d430f9
--- /dev/null
+++ b/backend/db/migrate/20260209133590_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/backend/db/migrate/20260209133591_add_automatic_to_spree_taxons.spree.rb b/backend/db/migrate/20260209133591_add_automatic_to_spree_taxons.spree.rb
new file mode 100644
index 0000000000..0a0050f4ed
--- /dev/null
+++ b/backend/db/migrate/20260209133591_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/backend/db/migrate/20260209133592_add_gateway_customer_profile_id_to_spree_payment_sources.spree.rb b/backend/db/migrate/20260209133592_add_gateway_customer_profile_id_to_spree_payment_sources.spree.rb
new file mode 100644
index 0000000000..373fb165ec
--- /dev/null
+++ b/backend/db/migrate/20260209133592_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/backend/db/migrate/20260209133593_add_accept_marketing_and_signup_for_an_account_to_spree_orders.spree.rb b/backend/db/migrate/20260209133593_add_accept_marketing_and_signup_for_an_account_to_spree_orders.spree.rb
new file mode 100644
index 0000000000..d085d9a340
--- /dev/null
+++ b/backend/db/migrate/20260209133593_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/backend/db/migrate/20260209133594_add_quick_checkout_to_spree_addresses.spree.rb b/backend/db/migrate/20260209133594_add_quick_checkout_to_spree_addresses.spree.rb
new file mode 100644
index 0000000000..94a28aaaa1
--- /dev/null
+++ b/backend/db/migrate/20260209133594_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/backend/db/migrate/20260209133595_add_preferences_to_spree_stores.spree.rb b/backend/db/migrate/20260209133595_add_preferences_to_spree_stores.spree.rb
new file mode 100644
index 0000000000..3441373359
--- /dev/null
+++ b/backend/db/migrate/20260209133595_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/backend/db/migrate/20260209133596_add_metadata_to_spree_stores.spree.rb b/backend/db/migrate/20260209133596_add_metadata_to_spree_stores.spree.rb
new file mode 100644
index 0000000000..3b1ec2bd14
--- /dev/null
+++ b/backend/db/migrate/20260209133596_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/backend/db/migrate/20260209133597_create_spree_custom_domains.spree.rb b/backend/db/migrate/20260209133597_create_spree_custom_domains.spree.rb
new file mode 100644
index 0000000000..a0de0b25f6
--- /dev/null
+++ b/backend/db/migrate/20260209133597_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/backend/db/migrate/20260209133598_add_default_locale_to_action_text_rich_texts.spree.rb b/backend/db/migrate/20260209133598_add_default_locale_to_action_text_rich_texts.spree.rb
new file mode 100644
index 0000000000..03d02631da
--- /dev/null
+++ b/backend/db/migrate/20260209133598_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/backend/db/migrate/20260209133599_create_spree_posts_and_spree_post_categories.spree.rb b/backend/db/migrate/20260209133599_create_spree_posts_and_spree_post_categories.spree.rb
new file mode 100644
index 0000000000..deec55cf61
--- /dev/null
+++ b/backend/db/migrate/20260209133599_create_spree_posts_and_spree_post_categories.spree.rb
@@ -0,0 +1,34 @@
+# This migration comes from spree (originally 20250121160028)
+class CreateSpreePostsAndSpreePostCategories < ActiveRecord::Migration[6.1]
+ def change
+ if !table_exists?(:spree_post_categories)
+ create_table :spree_post_categories do |t|
+ t.references :store, null: false, index: true
+ t.string :title, null: false
+ t.string :slug, null: false
+
+ t.timestamps
+
+ t.index ['slug', 'store_id'], name: 'index_spree_post_categories_on_slug_and_store_id', unique: true
+ end
+ end
+
+ if !table_exists?(:spree_posts)
+ create_table :spree_posts do |t|
+ t.references :author, index: true
+ t.datetime :published_at
+ t.string :title, null: false
+ t.string :slug, null: false
+ t.references :post_category, index: true
+ t.references :store, index: true
+ t.string :meta_title
+ t.string :meta_description
+
+ t.timestamps
+ t.datetime :deleted_at
+
+ t.index ['title'], name: 'index_spree_posts_on_title'
+ end
+ end
+ end
+end
diff --git a/backend/db/migrate/20260209133600_add_first_and_last_name_to_spree_admin_class.spree.rb b/backend/db/migrate/20260209133600_add_first_and_last_name_to_spree_admin_class.spree.rb
new file mode 100644
index 0000000000..8cc1b67244
--- /dev/null
+++ b/backend/db/migrate/20260209133600_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/backend/db/migrate/20260209133601_add_custom_code_fields_to_spree_store.spree.rb b/backend/db/migrate/20260209133601_add_custom_code_fields_to_spree_store.spree.rb
new file mode 100644
index 0000000000..fc8f8d605e
--- /dev/null
+++ b/backend/db/migrate/20260209133601_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/backend/db/migrate/20260209133602_add_kind_to_spree_properties.spree.rb b/backend/db/migrate/20260209133602_add_kind_to_spree_properties.spree.rb
new file mode 100644
index 0000000000..a8a4bc2019
--- /dev/null
+++ b/backend/db/migrate/20260209133602_add_kind_to_spree_properties.spree.rb
@@ -0,0 +1,6 @@
+# This migration comes from spree (originally 20250127083740)
+class AddKindToSpreeProperties < ActiveRecord::Migration[6.1]
+ def change
+ add_column :spree_properties, :kind, :integer, default: 0, if_not_exists: true
+ end
+end
diff --git a/backend/db/migrate/20260209133603_add_latitude_and_longitude_to_spree_addresses.spree.rb b/backend/db/migrate/20260209133603_add_latitude_and_longitude_to_spree_addresses.spree.rb
new file mode 100644
index 0000000000..efa8671d64
--- /dev/null
+++ b/backend/db/migrate/20260209133603_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/backend/db/migrate/20260209133604_add_phone_to_spree_users.spree.rb b/backend/db/migrate/20260209133604_add_phone_to_spree_users.spree.rb
new file mode 100644
index 0000000000..4e549a96f3
--- /dev/null
+++ b/backend/db/migrate/20260209133604_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/backend/db/migrate/20260209133605_create_spree_reports.spree.rb b/backend/db/migrate/20260209133605_create_spree_reports.spree.rb
new file mode 100644
index 0000000000..d4218ac260
--- /dev/null
+++ b/backend/db/migrate/20260209133605_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/backend/db/migrate/20260209133606_add_accepts_email_marketing_field_to_spree_users_table.spree.rb b/backend/db/migrate/20260209133606_add_accepts_email_marketing_field_to_spree_users_table.spree.rb
new file mode 100644
index 0000000000..fd40e16ef3
--- /dev/null
+++ b/backend/db/migrate/20260209133606_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/backend/db/migrate/20260209133607_create_action_text_video_embeds.spree.rb b/backend/db/migrate/20260209133607_create_action_text_video_embeds.spree.rb
new file mode 100644
index 0000000000..84588146d2
--- /dev/null
+++ b/backend/db/migrate/20260209133607_create_action_text_video_embeds.spree.rb
@@ -0,0 +1,12 @@
+# This migration comes from spree (originally 20250217171018)
+class CreateActionTextVideoEmbeds < ActiveRecord::Migration[6.1]
+ def change
+ create_table :action_text_video_embeds, if_not_exists: true do |t|
+ t.string :url, null: false
+ t.string :thumbnail_url, null: false
+ t.text :raw_html, null: false
+
+ t.timestamps
+ end
+ end
+end
diff --git a/backend/db/migrate/20260209133608_add_performed_by_to_spree_reimbursements.spree.rb b/backend/db/migrate/20260209133608_add_performed_by_to_spree_reimbursements.spree.rb
new file mode 100644
index 0000000000..a172975f0c
--- /dev/null
+++ b/backend/db/migrate/20260209133608_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/backend/db/migrate/20260209133609_remove_spree_posts_indices.spree.rb b/backend/db/migrate/20260209133609_remove_spree_posts_indices.spree.rb
new file mode 100644
index 0000000000..8ae14b9026
--- /dev/null
+++ b/backend/db/migrate/20260209133609_remove_spree_posts_indices.spree.rb
@@ -0,0 +1,8 @@
+# This migration comes from spree (originally 20250305121657)
+class RemoveSpreePostsIndices < ActiveRecord::Migration[7.2]
+ def change
+ if index_name_exists?(:spree_posts, 'index_spree_posts_on_slug_and_store_id')
+ remove_index :spree_posts, name: 'index_spree_posts_on_slug_and_store_id'
+ end
+ end
+end
diff --git a/backend/db/migrate/20260209133610_create_spree_gateway_customers.spree.rb b/backend/db/migrate/20260209133610_create_spree_gateway_customers.spree.rb
new file mode 100644
index 0000000000..9a485f2845
--- /dev/null
+++ b/backend/db/migrate/20260209133610_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/backend/db/migrate/20260209133611_add_unique_index_on_promotion_rules_associations.spree.rb b/backend/db/migrate/20260209133611_add_unique_index_on_promotion_rules_associations.spree.rb
new file mode 100644
index 0000000000..bb451c6fd3
--- /dev/null
+++ b/backend/db/migrate/20260209133611_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/backend/db/migrate/20260209133612_add_user_type_to_spree_role_users.spree.rb b/backend/db/migrate/20260209133612_add_user_type_to_spree_role_users.spree.rb
new file mode 100644
index 0000000000..3fbb624a86
--- /dev/null
+++ b/backend/db/migrate/20260209133612_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/backend/db/migrate/20260209133613_add_unique_index_on_promotion_action_line_items.spree.rb b/backend/db/migrate/20260209133613_add_unique_index_on_promotion_action_line_items.spree.rb
new file mode 100644
index 0000000000..fa3791d774
--- /dev/null
+++ b/backend/db/migrate/20260209133613_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/backend/db/migrate/20260209133614_create_spree_taggings_and_spree_tags.spree.rb b/backend/db/migrate/20260209133614_create_spree_taggings_and_spree_tags.spree.rb
new file mode 100644
index 0000000000..14a65431a6
--- /dev/null
+++ b/backend/db/migrate/20260209133614_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/backend/db/migrate/20260209133615_create_spree_integrations.spree.rb b/backend/db/migrate/20260209133615_create_spree_integrations.spree.rb
new file mode 100644
index 0000000000..32933daf76
--- /dev/null
+++ b/backend/db/migrate/20260209133615_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/backend/db/migrate/20260209133616_create_spree_invitations.spree.rb b/backend/db/migrate/20260209133616_create_spree_invitations.spree.rb
new file mode 100644
index 0000000000..10c22b958e
--- /dev/null
+++ b/backend/db/migrate/20260209133616_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/backend/db/migrate/20260209133617_add_resource_to_spree_role_users.spree.rb b/backend/db/migrate/20260209133617_add_resource_to_spree_role_users.spree.rb
new file mode 100644
index 0000000000..963ef92db2
--- /dev/null
+++ b/backend/db/migrate/20260209133617_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/backend/db/migrate/20260209133618_create_spree_gift_cards_and_spree_gift_card_batches.spree.rb b/backend/db/migrate/20260209133618_create_spree_gift_cards_and_spree_gift_card_batches.spree.rb
new file mode 100644
index 0000000000..41111ac574
--- /dev/null
+++ b/backend/db/migrate/20260209133618_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/backend/db/migrate/20260209133619_add_selected_locale_to_spree_admin_users.spree.rb b/backend/db/migrate/20260209133619_add_selected_locale_to_spree_admin_users.spree.rb
new file mode 100644
index 0000000000..c652c274c4
--- /dev/null
+++ b/backend/db/migrate/20260209133619_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/backend/db/migrate/20260209133620_add_session_id_to_spree_assets.spree.rb b/backend/db/migrate/20260209133620_add_session_id_to_spree_assets.spree.rb
new file mode 100644
index 0000000000..25733b73c6
--- /dev/null
+++ b/backend/db/migrate/20260209133620_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/backend/db/migrate/20260209133621_add_company_to_spree_stock_locations.spree.rb b/backend/db/migrate/20260209133621_add_company_to_spree_stock_locations.spree.rb
new file mode 100644
index 0000000000..a60e766f56
--- /dev/null
+++ b/backend/db/migrate/20260209133621_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/backend/db/migrate/20260209133622_enable_pg_trgm_extension.spree.rb b/backend/db/migrate/20260209133622_enable_pg_trgm_extension.spree.rb
new file mode 100644
index 0000000000..a1a658dc74
--- /dev/null
+++ b/backend/db/migrate/20260209133622_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/backend/db/migrate/20260209133623_add_missing_fields_to_users.spree.rb b/backend/db/migrate/20260209133623_add_missing_fields_to_users.spree.rb
new file mode 100644
index 0000000000..3c0fb7ef2c
--- /dev/null
+++ b/backend/db/migrate/20260209133623_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/backend/db/migrate/20260209133624_create_spree_metafields.spree.rb b/backend/db/migrate/20260209133624_create_spree_metafields.spree.rb
new file mode 100644
index 0000000000..2dc09e7281
--- /dev/null
+++ b/backend/db/migrate/20260209133624_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/backend/db/migrate/20260209133625_add_missing_unique_indexes_to_spree_option_types_and_values.spree.rb b/backend/db/migrate/20260209133625_add_missing_unique_indexes_to_spree_option_types_and_values.spree.rb
new file mode 100644
index 0000000000..f0155962aa
--- /dev/null
+++ b/backend/db/migrate/20260209133625_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/backend/db/migrate/20260209133626_add_unique_index_on_spree_properties_name.spree.rb b/backend/db/migrate/20260209133626_add_unique_index_on_spree_properties_name.spree.rb
new file mode 100644
index 0000000000..ec2681a4e5
--- /dev/null
+++ b/backend/db/migrate/20260209133626_add_unique_index_on_spree_properties_name.spree.rb
@@ -0,0 +1,25 @@
+# This migration comes from spree (originally 20250730154601)
+class AddUniqueIndexOnSpreePropertiesName < 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 properties
+ duplicates = Spree::Property.select(:name).group(:name).having('COUNT(*) > 1').reorder('').pluck(:name)
+
+ duplicates.each do |duplicate_name|
+ properties = Spree::Property.where(name: duplicate_name)
+
+ properties.each_with_index do |property, index|
+ next if index == 0 # Keep the first one unchanged
+
+ new_name = "#{duplicate_name}_#{index}"
+ property.update_columns(name: new_name, updated_at: Time.current)
+ end
+ end
+
+ # Add indexes
+ remove_index :spree_properties, :name, if_exists: true
+ add_index :spree_properties, :name, unique: true, if_not_exists: true
+ end
+end
diff --git a/backend/db/migrate/20260209133627_create_spree_policies.spree.rb b/backend/db/migrate/20260209133627_create_spree_policies.spree.rb
new file mode 100644
index 0000000000..6a1a0d3a0d
--- /dev/null
+++ b/backend/db/migrate/20260209133627_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/backend/db/migrate/20260209133628_fix_unique_index_on_spree_order_promotions.spree.rb b/backend/db/migrate/20260209133628_fix_unique_index_on_spree_order_promotions.spree.rb
new file mode 100644
index 0000000000..8260e9771c
--- /dev/null
+++ b/backend/db/migrate/20260209133628_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/backend/db/migrate/20260209133629_create_spree_newsletter_subscribers.spree.rb b/backend/db/migrate/20260209133629_create_spree_newsletter_subscribers.spree.rb
new file mode 100644
index 0000000000..a360c8b259
--- /dev/null
+++ b/backend/db/migrate/20260209133629_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/backend/db/migrate/20260209133630_fix_policies_store_association.spree.rb b/backend/db/migrate/20260209133630_fix_policies_store_association.spree.rb
new file mode 100644
index 0000000000..ba879c333e
--- /dev/null
+++ b/backend/db/migrate/20260209133630_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/backend/db/migrate/20260209133631_add_missing_index_on_spree_products_promotionable.spree.rb b/backend/db/migrate/20260209133631_add_missing_index_on_spree_products_promotionable.spree.rb
new file mode 100644
index 0000000000..7d1850d715
--- /dev/null
+++ b/backend/db/migrate/20260209133631_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/backend/db/migrate/20260209133632_add_missing_indexes_on_spree_adjustments.spree.rb b/backend/db/migrate/20260209133632_add_missing_indexes_on_spree_adjustments.spree.rb
new file mode 100644
index 0000000000..79fa4e207c
--- /dev/null
+++ b/backend/db/migrate/20260209133632_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/backend/db/migrate/20260209133633_add_metadata_to_spree_newsletter_subscribers.spree.rb b/backend/db/migrate/20260209133633_add_metadata_to_spree_newsletter_subscribers.spree.rb
new file mode 100644
index 0000000000..fa79698a73
--- /dev/null
+++ b/backend/db/migrate/20260209133633_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/backend/db/migrate/20260209133634_create_spree_imports.spree.rb b/backend/db/migrate/20260209133634_create_spree_imports.spree.rb
new file mode 100644
index 0000000000..f35482573c
--- /dev/null
+++ b/backend/db/migrate/20260209133634_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/backend/db/migrate/20260209133635_create_spree_user_identities.spree.rb b/backend/db/migrate/20260209133635_create_spree_user_identities.spree.rb
new file mode 100644
index 0000000000..3842b86614
--- /dev/null
+++ b/backend/db/migrate/20260209133635_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/backend/db/migrate/20260209133636_create_spree_price_lists.spree.rb b/backend/db/migrate/20260209133636_create_spree_price_lists.spree.rb
new file mode 100644
index 0000000000..7661893d87
--- /dev/null
+++ b/backend/db/migrate/20260209133636_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/backend/db/migrate/20260209133637_create_spree_price_rules.spree.rb b/backend/db/migrate/20260209133637_create_spree_price_rules.spree.rb
new file mode 100644
index 0000000000..ced9ac0202
--- /dev/null
+++ b/backend/db/migrate/20260209133637_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/backend/db/migrate/20260209133638_add_price_list_id_to_spree_prices.spree.rb b/backend/db/migrate/20260209133638_add_price_list_id_to_spree_prices.spree.rb
new file mode 100644
index 0000000000..3c9d94aa0a
--- /dev/null
+++ b/backend/db/migrate/20260209133638_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/backend/db/migrate/20260209133639_add_price_list_id_to_spree_line_items.spree.rb b/backend/db/migrate/20260209133639_add_price_list_id_to_spree_line_items.spree.rb
new file mode 100644
index 0000000000..16c898bf98
--- /dev/null
+++ b/backend/db/migrate/20260209133639_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/backend/db/migrate/20260209133640_fix_indexes_on_friendly_id_slugs.spree.rb b/backend/db/migrate/20260209133640_fix_indexes_on_friendly_id_slugs.spree.rb
new file mode 100644
index 0000000000..15bb8bb07e
--- /dev/null
+++ b/backend/db/migrate/20260209133640_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/backend/db/migrate/20260209133641_create_spree_webhook_endpoints.spree.rb b/backend/db/migrate/20260209133641_create_spree_webhook_endpoints.spree.rb
new file mode 100644
index 0000000000..74c0cd21b0
--- /dev/null
+++ b/backend/db/migrate/20260209133641_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/backend/db/migrate/20260209133642_create_spree_webhook_deliveries.spree.rb b/backend/db/migrate/20260209133642_create_spree_webhook_deliveries.spree.rb
new file mode 100644
index 0000000000..ec02564dab
--- /dev/null
+++ b/backend/db/migrate/20260209133642_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/backend/db/migrate/20260209133643_add_performance_indexes_to_spree_adjustments.spree.rb b/backend/db/migrate/20260209133643_add_performance_indexes_to_spree_adjustments.spree.rb
new file mode 100644
index 0000000000..90a68a480a
--- /dev/null
+++ b/backend/db/migrate/20260209133643_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/backend/db/migrate/20260209133644_fix_spree_prices_unique_indexes.spree.rb b/backend/db/migrate/20260209133644_fix_spree_prices_unique_indexes.spree.rb
new file mode 100644
index 0000000000..6496809a2d
--- /dev/null
+++ b/backend/db/migrate/20260209133644_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/backend/db/migrate/20260209133645_create_spree_customer_groups.spree.rb b/backend/db/migrate/20260209133645_create_spree_customer_groups.spree.rb
new file mode 100644
index 0000000000..195b4ae18f
--- /dev/null
+++ b/backend/db/migrate/20260209133645_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/backend/db/migrate/20260209133646_create_spree_customer_group_users.spree.rb b/backend/db/migrate/20260209133646_create_spree_customer_group_users.spree.rb
new file mode 100644
index 0000000000..89b3589a21
--- /dev/null
+++ b/backend/db/migrate/20260209133646_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/backend/db/migrate/20260209133647_remove_not_null_constraint_from_policy_name.spree.rb b/backend/db/migrate/20260209133647_remove_not_null_constraint_from_policy_name.spree.rb
new file mode 100644
index 0000000000..88366c9347
--- /dev/null
+++ b/backend/db/migrate/20260209133647_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/backend/db/migrate/20260209133648_add_statistics_to_store_products.spree.rb b/backend/db/migrate/20260209133648_add_statistics_to_store_products.spree.rb
new file mode 100644
index 0000000000..68ab4a4b7c
--- /dev/null
+++ b/backend/db/migrate/20260209133648_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/backend/db/migrate/20260209133649_add_counter_caches_to_spree_products.spree.rb b/backend/db/migrate/20260209133649_add_counter_caches_to_spree_products.spree.rb
new file mode 100644
index 0000000000..717451e40c
--- /dev/null
+++ b/backend/db/migrate/20260209133649_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/backend/db/migrate/20260209133650_add_counter_caches_to_spree_taxons.spree.rb b/backend/db/migrate/20260209133650_add_counter_caches_to_spree_taxons.spree.rb
new file mode 100644
index 0000000000..da8317db16
--- /dev/null
+++ b/backend/db/migrate/20260209133650_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/backend/db/migrate/20260209133651_add_image_count_to_spree_variants.spree.rb b/backend/db/migrate/20260209133651_add_image_count_to_spree_variants.spree.rb
new file mode 100644
index 0000000000..448a95e2a9
--- /dev/null
+++ b/backend/db/migrate/20260209133651_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/backend/db/migrate/20260209133652_create_spree_api_keys.spree.rb b/backend/db/migrate/20260209133652_create_spree_api_keys.spree.rb
new file mode 100644
index 0000000000..15e15a8b58
--- /dev/null
+++ b/backend/db/migrate/20260209133652_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/backend/db/migrate/20260209133653_add_prefix_id_to_spree_tables.spree.rb b/backend/db/migrate/20260209133653_add_prefix_id_to_spree_tables.spree.rb
new file mode 100644
index 0000000000..465d9e603c
--- /dev/null
+++ b/backend/db/migrate/20260209133653_add_prefix_id_to_spree_tables.spree.rb
@@ -0,0 +1,105 @@
+# frozen_string_literal: true
+
+# This migration comes from spree (originally 20260124000000)
+class AddPrefixIdToSpreeTables < ActiveRecord::Migration[7.2]
+ def change
+ # Tables that need prefix_id for API v3
+ tables = %i[
+ spree_addresses
+ spree_adjustments
+ spree_api_keys
+ spree_assets
+ spree_calculators
+ spree_coupon_codes
+ spree_credit_cards
+ spree_custom_domains
+ spree_customer_groups
+ spree_customer_returns
+ spree_data_feeds
+ spree_digital_links
+ spree_digitals
+ spree_exports
+ spree_gateway_customers
+ spree_gift_card_batches
+ spree_gift_cards
+ spree_import_mappings
+ spree_import_rows
+ spree_imports
+ spree_integrations
+ spree_inventory_units
+ spree_invitations
+ spree_line_items
+ spree_log_entries
+ spree_metafield_definitions
+ spree_metafields
+ spree_newsletter_subscribers
+ spree_option_types
+ spree_option_values
+ spree_orders
+ spree_payment_capture_events
+ spree_payment_methods
+ spree_payment_sources
+ spree_payments
+ spree_policies
+ spree_post_categories
+ spree_posts
+ spree_price_lists
+ spree_price_rules
+ spree_prices
+ spree_products
+ spree_products_stores
+ spree_promotion_actions
+ spree_promotion_categories
+ spree_promotion_rules
+ spree_promotions
+ spree_prototypes
+ spree_refund_reasons
+ spree_refunds
+ spree_reimbursement_credits
+ spree_reimbursement_types
+ spree_reimbursements
+ spree_reports
+ spree_return_authorization_reasons
+ spree_return_authorizations
+ spree_return_items
+ spree_roles
+ spree_shipments
+ spree_shipping_categories
+ spree_shipping_method_categories
+ spree_shipping_methods
+ spree_shipping_rates
+ spree_state_changes
+ spree_stock_items
+ spree_stock_locations
+ spree_stock_movements
+ spree_stock_transfers
+ spree_store_credit_categories
+ spree_store_credit_events
+ spree_store_credit_types
+ spree_store_credits
+ spree_stores
+ spree_tax_categories
+ spree_tax_rates
+ spree_taxon_rules
+ spree_taxons
+ spree_taxonomies
+ spree_user_identities
+ spree_variants
+ spree_webhook_deliveries
+ spree_webhook_endpoints
+ spree_wished_items
+ spree_wishlists
+ spree_zones
+ ]
+
+ tables.each do |table|
+ add_column table, :prefix_id, :string unless column_exists?(table, :prefix_id)
+ add_index table, :prefix_id, unique: true unless index_exists?(table, :prefix_id)
+ end
+
+ [Spree.user_class, Spree.admin_user_class].compact.each do |user_class|
+ add_column user_class.table_name, :prefix_id, :string unless column_exists?(user_class.table_name, :prefix_id)
+ add_index user_class.table_name, :prefix_id, unique: true unless index_exists?(user_class.table_name, :prefix_id)
+ end
+ end
+end
diff --git a/backend/db/migrate/20260209133654_add_thumbnail_id_to_spree_variants_and_products.spree.rb b/backend/db/migrate/20260209133654_add_thumbnail_id_to_spree_variants_and_products.spree.rb
new file mode 100644
index 0000000000..63d9e76eea
--- /dev/null
+++ b/backend/db/migrate/20260209133654_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/backend/db/schema.rb b/backend/db/schema.rb
index f8be1d34a1..d8497da6c0 100644
--- a/backend/db/schema.rb
+++ b/backend/db/schema.rb
@@ -10,8 +10,2169 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema[8.1].define(version: 0) do
+ActiveRecord::Schema[8.1].define(version: 2026_02_09_133654) do
# These are extensions that must be enabled in order to support this database
enable_extension "pg_catalog.plpgsql"
+ enable_extension "pg_trgm"
+ create_table "action_text_rich_texts", force: :cascade do |t|
+ t.text "body"
+ t.datetime "created_at", null: false
+ t.string "locale", default: "en", null: false
+ t.string "name", null: false
+ t.bigint "record_id", null: false
+ t.string "record_type", null: false
+ t.datetime "updated_at", null: false
+ t.index ["record_type", "record_id", "name", "locale"], name: "index_action_text_rich_texts_uniqueness", unique: true
+ end
+
+ create_table "action_text_video_embeds", force: :cascade do |t|
+ t.datetime "created_at", null: false
+ t.text "raw_html", null: false
+ t.string "thumbnail_url", null: false
+ t.datetime "updated_at", null: false
+ t.string "url", null: false
+ end
+
+ create_table "active_storage_attachments", force: :cascade do |t|
+ t.bigint "blob_id", null: false
+ t.datetime "created_at", null: false
+ t.string "name", null: false
+ t.bigint "record_id", null: false
+ t.string "record_type", null: false
+ t.index ["blob_id"], name: "index_active_storage_attachments_on_blob_id"
+ t.index ["record_type", "record_id", "name", "blob_id"], name: "index_active_storage_attachments_uniqueness", unique: true
+ end
+
+ create_table "active_storage_blobs", force: :cascade do |t|
+ t.bigint "byte_size", null: false
+ t.string "checksum"
+ t.string "content_type"
+ t.datetime "created_at", null: false
+ t.string "filename", null: false
+ t.string "key", null: false
+ t.text "metadata"
+ t.string "service_name", null: false
+ t.index ["key"], name: "index_active_storage_blobs_on_key", unique: true
+ end
+
+ create_table "active_storage_variant_records", force: :cascade do |t|
+ t.bigint "blob_id", null: false
+ t.string "variation_digest", null: false
+ t.index ["blob_id", "variation_digest"], name: "index_active_storage_variant_records_uniqueness", unique: true
+ end
+
+ create_table "friendly_id_slugs", force: :cascade do |t|
+ t.datetime "created_at", precision: nil
+ t.datetime "deleted_at", precision: nil
+ t.string "locale"
+ t.string "scope"
+ t.string "slug", null: false
+ t.bigint "sluggable_id", null: false
+ t.string "sluggable_type", limit: 50
+ t.index ["deleted_at"], name: "index_friendly_id_slugs_on_deleted_at"
+ t.index ["locale"], name: "index_friendly_id_slugs_on_locale"
+ t.index ["slug", "sluggable_type", "locale"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type_and_locale"
+ t.index ["slug", "sluggable_type", "scope", "locale"], name: "index_friendly_id_slugs_unique", unique: true
+ 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 "address1"
+ t.string "address2"
+ t.string "alternative_phone"
+ t.string "city"
+ t.string "company"
+ t.bigint "country_id"
+ t.datetime "created_at", null: false
+ t.datetime "deleted_at", precision: nil
+ t.string "firstname"
+ t.string "label"
+ t.string "lastname"
+ t.decimal "latitude"
+ t.decimal "longitude"
+ t.string "phone"
+ t.string "prefix_id"
+ t.jsonb "private_metadata"
+ t.jsonb "public_metadata"
+ t.boolean "quick_checkout", default: false
+ t.bigint "state_id"
+ t.string "state_name"
+ t.datetime "updated_at", null: false
+ t.bigint "user_id"
+ t.string "zipcode"
+ 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 ["prefix_id"], name: "index_spree_addresses_on_prefix_id", unique: true
+ t.index ["quick_checkout"], name: "index_spree_addresses_on_quick_checkout"
+ 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.bigint "adjustable_id"
+ t.string "adjustable_type"
+ t.decimal "amount", precision: 10, scale: 2
+ t.datetime "created_at", null: false
+ t.boolean "eligible", default: true
+ t.boolean "included", default: false
+ t.string "label"
+ t.boolean "mandatory"
+ t.bigint "order_id", null: false
+ t.string "prefix_id"
+ t.bigint "source_id"
+ t.string "source_type"
+ t.string "state"
+ t.datetime "updated_at", null: false
+ t.index ["adjustable_id", "adjustable_type"], name: "index_spree_adjustments_on_adjustable_id_and_adjustable_type"
+ t.index ["adjustable_type", "adjustable_id", "source_type"], name: "index_spree_adjustments_on_adjustable_and_source_type"
+ t.index ["amount"], name: "index_spree_adjustments_on_amount"
+ t.index ["eligible"], name: "index_spree_adjustments_on_eligible"
+ t.index ["order_id", "eligible", "source_type"], name: "index_spree_adjustments_on_order_eligible_source_type"
+ t.index ["order_id", "state"], name: "index_spree_adjustments_on_order_id_and_state"
+ t.index ["order_id"], name: "index_spree_adjustments_on_order_id"
+ t.index ["prefix_id"], name: "index_spree_adjustments_on_prefix_id", unique: true
+ t.index ["source_id", "source_type"], name: "index_spree_adjustments_on_source_id_and_source_type"
+ t.index ["source_type"], name: "index_spree_adjustments_on_source_type"
+ end
+
+ create_table "spree_admin_users", force: :cascade do |t|
+ t.datetime "created_at", null: false
+ t.string "email", default: "", null: false
+ t.string "encrypted_password", default: "", null: false
+ t.string "first_name"
+ t.string "last_name"
+ t.string "login"
+ t.string "prefix_id"
+ t.jsonb "private_metadata"
+ t.jsonb "public_metadata"
+ t.datetime "remember_created_at"
+ t.datetime "reset_password_sent_at"
+ t.string "reset_password_token"
+ t.string "selected_locale"
+ t.datetime "updated_at", null: false
+ t.index ["email"], name: "index_spree_admin_users_on_email", unique: true
+ t.index ["prefix_id"], name: "index_spree_admin_users_on_prefix_id", unique: true
+ t.index ["reset_password_token"], name: "index_spree_admin_users_on_reset_password_token", unique: true
+ end
+
+ create_table "spree_api_keys", force: :cascade do |t|
+ t.datetime "created_at", null: false
+ t.bigint "created_by_id"
+ t.string "created_by_type"
+ t.string "key_type", null: false
+ t.datetime "last_used_at"
+ t.string "name", null: false
+ t.string "prefix_id"
+ t.datetime "revoked_at"
+ t.bigint "revoked_by_id"
+ t.string "revoked_by_type"
+ t.bigint "store_id", null: false
+ t.string "token", null: false
+ t.datetime "updated_at", null: false
+ t.index ["created_by_type", "created_by_id"], name: "index_spree_api_keys_on_created_by"
+ t.index ["key_type"], name: "index_spree_api_keys_on_key_type"
+ t.index ["prefix_id"], name: "index_spree_api_keys_on_prefix_id", unique: true
+ t.index ["revoked_by_type", "revoked_by_id"], name: "index_spree_api_keys_on_revoked_by"
+ t.index ["store_id", "key_type"], name: "index_spree_api_keys_on_store_id_and_key_type"
+ t.index ["store_id"], name: "index_spree_api_keys_on_store_id"
+ t.index ["token"], name: "index_spree_api_keys_on_token", unique: true
+ end
+
+ create_table "spree_assets", force: :cascade do |t|
+ t.text "alt"
+ t.string "attachment_content_type"
+ t.string "attachment_file_name"
+ t.integer "attachment_file_size"
+ t.integer "attachment_height"
+ t.datetime "attachment_updated_at", precision: nil
+ t.integer "attachment_width"
+ t.datetime "created_at", precision: nil
+ t.integer "position"
+ t.string "prefix_id"
+ t.jsonb "private_metadata"
+ t.jsonb "public_metadata"
+ t.string "session_id"
+ t.string "type", limit: 75
+ t.datetime "updated_at", precision: nil
+ t.bigint "viewable_id"
+ t.string "viewable_type"
+ t.index ["position"], name: "index_spree_assets_on_position"
+ t.index ["prefix_id"], name: "index_spree_assets_on_prefix_id", unique: true
+ 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.bigint "calculable_id"
+ t.string "calculable_type"
+ t.datetime "created_at", null: false
+ t.datetime "deleted_at", precision: nil
+ t.text "preferences"
+ t.string "prefix_id"
+ t.string "type"
+ t.datetime "updated_at", null: false
+ 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"
+ t.index ["prefix_id"], name: "index_spree_calculators_on_prefix_id", unique: true
+ end
+
+ create_table "spree_countries", force: :cascade do |t|
+ t.datetime "created_at", precision: nil
+ t.string "iso", null: false
+ t.string "iso3", null: false
+ t.string "iso_name"
+ t.string "name"
+ t.integer "numcode"
+ t.boolean "states_required", default: false
+ t.datetime "updated_at", precision: nil
+ t.boolean "zipcode_required", default: true
+ t.index ["iso"], name: "index_spree_countries_on_iso", unique: true
+ t.index ["iso3"], name: "index_spree_countries_on_iso3", unique: true
+ t.index ["iso_name"], name: "index_spree_countries_on_iso_name", unique: true
+ t.index ["name"], name: "index_spree_countries_on_name", unique: true
+ end
+
+ create_table "spree_coupon_codes", force: :cascade do |t|
+ t.string "code"
+ t.datetime "created_at", null: false
+ t.datetime "deleted_at", precision: nil
+ t.bigint "order_id"
+ t.string "prefix_id"
+ t.bigint "promotion_id"
+ t.integer "state", default: 0, null: false
+ t.datetime "updated_at", null: false
+ t.index ["code"], name: "index_spree_coupon_codes_on_code", unique: true
+ t.index ["deleted_at"], name: "index_spree_coupon_codes_on_deleted_at"
+ t.index ["order_id"], name: "index_spree_coupon_codes_on_order_id"
+ t.index ["prefix_id"], name: "index_spree_coupon_codes_on_prefix_id", unique: true
+ t.index ["promotion_id"], name: "index_spree_coupon_codes_on_promotion_id"
+ t.index ["state"], name: "index_spree_coupon_codes_on_state"
+ end
+
+ create_table "spree_credit_cards", force: :cascade do |t|
+ t.bigint "address_id"
+ t.string "cc_type"
+ t.datetime "created_at", null: false
+ t.boolean "default", default: false, null: false
+ t.datetime "deleted_at", precision: nil
+ t.bigint "gateway_customer_id"
+ t.string "gateway_customer_profile_id"
+ t.string "gateway_payment_profile_id"
+ t.string "last_digits"
+ t.string "month"
+ t.string "name"
+ t.bigint "payment_method_id"
+ t.string "prefix_id"
+ t.jsonb "private_metadata"
+ t.jsonb "public_metadata"
+ t.datetime "updated_at", null: false
+ t.bigint "user_id"
+ t.string "year"
+ 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 ["gateway_customer_id"], name: "index_spree_credit_cards_on_gateway_customer_id"
+ t.index ["payment_method_id"], name: "index_spree_credit_cards_on_payment_method_id"
+ t.index ["prefix_id"], name: "index_spree_credit_cards_on_prefix_id", unique: true
+ t.index ["user_id"], name: "index_spree_credit_cards_on_user_id"
+ end
+
+ create_table "spree_custom_domains", force: :cascade do |t|
+ t.datetime "created_at", null: false
+ t.boolean "default", default: false, null: false
+ t.string "prefix_id"
+ t.jsonb "private_metadata"
+ t.jsonb "public_metadata"
+ t.boolean "status", default: false
+ t.bigint "store_id", null: false
+ t.datetime "updated_at", null: false
+ t.string "url", null: false
+ t.index ["prefix_id"], name: "index_spree_custom_domains_on_prefix_id", unique: true
+ t.index ["store_id"], name: "index_spree_custom_domains_on_store_id"
+ t.index ["url"], name: "index_spree_custom_domains_on_url", unique: true
+ end
+
+ create_table "spree_customer_group_users", force: :cascade do |t|
+ t.datetime "created_at", null: false
+ t.bigint "customer_group_id", null: false
+ t.datetime "updated_at", null: false
+ t.bigint "user_id", null: false
+ t.string "user_type", null: false
+ t.index ["customer_group_id", "user_id", "user_type"], name: "index_spree_customer_group_users_unique", unique: true
+ t.index ["customer_group_id"], name: "index_spree_customer_group_users_on_customer_group_id"
+ t.index ["user_type", "user_id"], name: "index_spree_customer_group_users_on_user"
+ end
+
+ create_table "spree_customer_groups", force: :cascade do |t|
+ t.datetime "created_at", null: false
+ t.datetime "deleted_at"
+ t.text "description"
+ t.string "name", null: false
+ t.string "prefix_id"
+ t.bigint "store_id", null: false
+ t.datetime "updated_at", null: false
+ t.index ["deleted_at"], name: "index_spree_customer_groups_on_deleted_at"
+ t.index ["prefix_id"], name: "index_spree_customer_groups_on_prefix_id", unique: true
+ t.index ["store_id", "name"], name: "index_spree_customer_groups_on_store_id_and_name", unique: true, where: "(deleted_at IS NULL)"
+ t.index ["store_id"], name: "index_spree_customer_groups_on_store_id"
+ end
+
+ create_table "spree_customer_returns", force: :cascade do |t|
+ t.datetime "created_at", null: false
+ t.string "number"
+ t.string "prefix_id"
+ t.jsonb "private_metadata"
+ t.jsonb "public_metadata"
+ t.bigint "stock_location_id"
+ t.bigint "store_id"
+ t.datetime "updated_at", null: false
+ t.index ["number"], name: "index_spree_customer_returns_on_number", unique: true
+ t.index ["prefix_id"], name: "index_spree_customer_returns_on_prefix_id", 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_data_feeds", force: :cascade do |t|
+ t.boolean "active", default: true
+ t.datetime "created_at", null: false
+ t.string "name"
+ t.string "prefix_id"
+ t.string "slug"
+ t.bigint "store_id"
+ t.string "type"
+ t.datetime "updated_at", null: false
+ t.index ["prefix_id"], name: "index_spree_data_feeds_on_prefix_id", unique: true
+ t.index ["store_id", "slug", "type"], name: "index_spree_data_feeds_on_store_id_and_slug_and_type"
+ t.index ["store_id"], name: "index_spree_data_feeds_on_store_id"
+ end
+
+ create_table "spree_digital_links", force: :cascade do |t|
+ t.integer "access_counter"
+ t.datetime "created_at", precision: nil, null: false
+ t.bigint "digital_id"
+ t.bigint "line_item_id"
+ t.string "prefix_id"
+ t.string "token"
+ t.datetime "updated_at", precision: nil, null: false
+ t.index ["digital_id"], name: "index_spree_digital_links_on_digital_id"
+ t.index ["line_item_id"], name: "index_spree_digital_links_on_line_item_id"
+ t.index ["prefix_id"], name: "index_spree_digital_links_on_prefix_id", unique: true
+ t.index ["token"], name: "index_spree_digital_links_on_token", unique: true
+ end
+
+ create_table "spree_digitals", force: :cascade do |t|
+ t.datetime "created_at", precision: nil, null: false
+ t.string "prefix_id"
+ t.datetime "updated_at", precision: nil, null: false
+ t.bigint "variant_id"
+ t.index ["prefix_id"], name: "index_spree_digitals_on_prefix_id", unique: true
+ t.index ["variant_id"], name: "index_spree_digitals_on_variant_id"
+ end
+
+ create_table "spree_exports", force: :cascade do |t|
+ t.datetime "created_at", null: false
+ t.integer "format", null: false
+ t.string "number", limit: 32, null: false
+ t.string "prefix_id"
+ t.jsonb "search_params"
+ t.bigint "store_id", null: false
+ t.string "type", null: false
+ t.datetime "updated_at", null: false
+ t.bigint "user_id"
+ t.index ["format"], name: "index_spree_exports_on_format"
+ t.index ["number"], name: "index_spree_exports_on_number", unique: true
+ t.index ["prefix_id"], name: "index_spree_exports_on_prefix_id", unique: true
+ t.index ["store_id"], name: "index_spree_exports_on_store_id"
+ t.index ["user_id"], name: "index_spree_exports_on_user_id"
+ end
+
+ create_table "spree_gateway_customers", force: :cascade do |t|
+ t.datetime "created_at", null: false
+ t.bigint "payment_method_id", null: false
+ t.string "prefix_id"
+ t.string "profile_id", null: false
+ t.datetime "updated_at", null: false
+ t.bigint "user_id", null: false
+ t.index ["payment_method_id"], name: "index_spree_gateway_customers_on_payment_method_id"
+ t.index ["prefix_id"], name: "index_spree_gateway_customers_on_prefix_id", unique: true
+ 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
+
+ create_table "spree_gateways", force: :cascade do |t|
+ t.boolean "active", default: true
+ t.datetime "created_at", null: false
+ t.text "description"
+ t.string "environment", default: "development"
+ t.string "name"
+ t.text "preferences"
+ t.string "server", default: "test"
+ t.boolean "test_mode", default: true
+ t.string "type"
+ t.datetime "updated_at", null: false
+ t.index ["active"], name: "index_spree_gateways_on_active"
+ t.index ["test_mode"], name: "index_spree_gateways_on_test_mode"
+ end
+
+ create_table "spree_gift_card_batches", force: :cascade do |t|
+ t.decimal "amount", precision: 10, scale: 2, null: false
+ t.integer "codes_count", default: 1, null: false
+ t.datetime "created_at", null: false
+ t.bigint "created_by_id"
+ t.string "currency", null: false
+ t.date "expires_at"
+ t.string "prefix"
+ t.string "prefix_id"
+ t.bigint "store_id", null: false
+ t.datetime "updated_at", null: false
+ t.index ["created_by_id"], name: "index_spree_gift_card_batches_on_created_by_id"
+ t.index ["prefix_id"], name: "index_spree_gift_card_batches_on_prefix_id", unique: true
+ t.index ["store_id"], name: "index_spree_gift_card_batches_on_store_id"
+ end
+
+ create_table "spree_gift_cards", force: :cascade do |t|
+ t.decimal "amount", precision: 10, scale: 2, null: false
+ t.decimal "amount_authorized", precision: 10, scale: 2, default: "0.0", null: false
+ t.decimal "amount_used", precision: 10, scale: 2, default: "0.0", null: false
+ t.string "code", null: false
+ t.datetime "created_at", null: false
+ t.bigint "created_by_id"
+ t.string "currency", null: false
+ t.date "expires_at"
+ t.bigint "gift_card_batch_id"
+ t.string "prefix_id"
+ t.datetime "redeemed_at"
+ t.string "state", null: false
+ t.bigint "store_id", null: false
+ t.datetime "updated_at", null: false
+ t.bigint "user_id"
+ t.index ["code"], name: "index_spree_gift_cards_on_code", unique: true
+ t.index ["created_by_id"], name: "index_spree_gift_cards_on_created_by_id"
+ t.index ["expires_at"], name: "index_spree_gift_cards_on_expires_at"
+ t.index ["gift_card_batch_id"], name: "index_spree_gift_cards_on_gift_card_batch_id"
+ t.index ["prefix_id"], name: "index_spree_gift_cards_on_prefix_id", unique: true
+ t.index ["redeemed_at"], name: "index_spree_gift_cards_on_redeemed_at"
+ t.index ["state"], name: "index_spree_gift_cards_on_state"
+ t.index ["store_id"], name: "index_spree_gift_cards_on_store_id"
+ t.index ["user_id"], name: "index_spree_gift_cards_on_user_id"
+ end
+
+ create_table "spree_import_mappings", force: :cascade do |t|
+ t.datetime "created_at", null: false
+ t.string "file_column"
+ t.bigint "import_id", null: false
+ t.string "prefix_id"
+ t.string "schema_field", null: false
+ t.datetime "updated_at", null: false
+ t.index ["file_column"], name: "index_spree_import_mappings_on_file_column"
+ t.index ["import_id", "schema_field"], name: "index_spree_import_mappings_on_import_id_and_schema_field", unique: true
+ t.index ["import_id"], name: "index_spree_import_mappings_on_import_id"
+ t.index ["prefix_id"], name: "index_spree_import_mappings_on_prefix_id", unique: true
+ end
+
+ create_table "spree_import_rows", force: :cascade do |t|
+ t.datetime "created_at", null: false
+ t.text "data", null: false
+ t.bigint "import_id", null: false
+ t.bigint "item_id"
+ t.string "item_type"
+ t.string "prefix_id"
+ t.integer "row_number", null: false
+ t.string "status", null: false
+ t.datetime "updated_at", null: false
+ t.text "validation_errors"
+ t.index ["import_id", "row_number"], name: "index_spree_import_rows_on_import_id_and_row_number", unique: true
+ t.index ["import_id"], name: "index_spree_import_rows_on_import_id"
+ t.index ["item_type", "item_id"], name: "index_spree_import_rows_on_item"
+ t.index ["prefix_id"], name: "index_spree_import_rows_on_prefix_id", unique: true
+ t.index ["status"], name: "index_spree_import_rows_on_status"
+ end
+
+ create_table "spree_imports", force: :cascade do |t|
+ t.datetime "created_at", null: false
+ t.string "number", limit: 32, null: false
+ t.bigint "owner_id", null: false
+ t.string "owner_type", null: false
+ t.text "preferences"
+ t.string "prefix_id"
+ t.text "processing_errors"
+ t.integer "rows_count", default: 0, null: false
+ t.string "status", null: false
+ t.string "type", null: false
+ t.datetime "updated_at", null: false
+ t.bigint "user_id", null: false
+ t.index ["number"], name: "index_spree_imports_on_number", unique: true
+ t.index ["owner_type", "owner_id"], name: "index_spree_imports_on_owner"
+ t.index ["prefix_id"], name: "index_spree_imports_on_prefix_id", unique: true
+ t.index ["status"], name: "index_spree_imports_on_status"
+ t.index ["type"], name: "index_spree_imports_on_type"
+ t.index ["user_id"], name: "index_spree_imports_on_user_id"
+ end
+
+ create_table "spree_integrations", force: :cascade do |t|
+ t.boolean "active", default: false, null: false
+ t.datetime "created_at", null: false
+ t.text "preferences"
+ t.string "prefix_id"
+ t.bigint "store_id", null: false
+ t.string "type", null: false
+ t.datetime "updated_at", null: false
+ t.index ["active"], name: "index_spree_integrations_on_active"
+ t.index ["prefix_id"], name: "index_spree_integrations_on_prefix_id", unique: true
+ t.index ["store_id"], name: "index_spree_integrations_on_store_id"
+ t.index ["type"], name: "index_spree_integrations_on_type"
+ end
+
+ create_table "spree_inventory_units", force: :cascade do |t|
+ t.datetime "created_at", null: false
+ t.bigint "line_item_id"
+ t.bigint "order_id"
+ t.bigint "original_return_item_id"
+ t.boolean "pending", default: true
+ t.string "prefix_id"
+ t.integer "quantity", default: 1
+ t.bigint "shipment_id"
+ t.string "state"
+ t.datetime "updated_at", null: false
+ t.bigint "variant_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 ["prefix_id"], name: "index_spree_inventory_units_on_prefix_id", unique: true
+ 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_invitations", force: :cascade do |t|
+ t.datetime "accepted_at"
+ t.datetime "created_at", null: false
+ t.datetime "deleted_at"
+ t.string "email", null: false
+ t.datetime "expires_at"
+ t.bigint "invitee_id"
+ t.string "invitee_type"
+ t.bigint "inviter_id", null: false
+ t.string "inviter_type", null: false
+ t.string "prefix_id"
+ t.bigint "resource_id", null: false
+ t.string "resource_type", null: false
+ t.bigint "role_id", null: false
+ t.string "status", null: false
+ t.string "token", null: false
+ t.datetime "updated_at", null: false
+ t.index ["deleted_at"], name: "index_spree_invitations_on_deleted_at"
+ t.index ["email"], name: "index_spree_invitations_on_email"
+ t.index ["expires_at"], name: "index_spree_invitations_on_expires_at"
+ t.index ["invitee_type", "invitee_id"], name: "index_spree_invitations_on_invitee"
+ t.index ["inviter_type", "inviter_id"], name: "index_spree_invitations_on_inviter"
+ t.index ["prefix_id"], name: "index_spree_invitations_on_prefix_id", unique: true
+ t.index ["resource_type", "resource_id"], name: "index_spree_invitations_on_resource"
+ t.index ["role_id"], name: "index_spree_invitations_on_role_id"
+ t.index ["status"], name: "index_spree_invitations_on_status"
+ t.index ["token"], name: "index_spree_invitations_on_token", unique: true
+ end
+
+ create_table "spree_line_items", force: :cascade do |t|
+ t.decimal "additional_tax_total", precision: 10, scale: 2, default: "0.0"
+ t.decimal "adjustment_total", precision: 10, scale: 2, default: "0.0"
+ t.decimal "cost_price", precision: 10, scale: 2
+ t.datetime "created_at", null: false
+ t.string "currency"
+ t.decimal "included_tax_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.bigint "order_id"
+ t.decimal "pre_tax_amount", precision: 12, scale: 4, default: "0.0", null: false
+ t.string "prefix_id"
+ t.decimal "price", precision: 10, scale: 2, null: false
+ t.bigint "price_list_id"
+ t.jsonb "private_metadata"
+ t.decimal "promo_total", precision: 10, scale: 2, default: "0.0"
+ t.jsonb "public_metadata"
+ t.integer "quantity", null: false
+ t.bigint "tax_category_id"
+ t.decimal "taxable_adjustment_total", precision: 10, scale: 2, default: "0.0", null: false
+ t.datetime "updated_at", null: false
+ t.bigint "variant_id"
+ t.index ["order_id"], name: "index_spree_line_items_on_order_id"
+ t.index ["prefix_id"], name: "index_spree_line_items_on_prefix_id", unique: true
+ t.index ["price_list_id"], name: "index_spree_line_items_on_price_list_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.datetime "created_at", null: false
+ t.text "details"
+ t.string "prefix_id"
+ t.bigint "source_id"
+ t.string "source_type"
+ t.datetime "updated_at", null: false
+ t.index ["prefix_id"], name: "index_spree_log_entries_on_prefix_id", unique: true
+ t.index ["source_id", "source_type"], name: "index_spree_log_entries_on_source_id_and_source_type"
+ end
+
+ create_table "spree_metafield_definitions", force: :cascade do |t|
+ t.datetime "created_at", null: false
+ t.string "display_on", default: "both", null: false
+ t.string "key", null: false
+ t.string "metafield_type", null: false
+ t.string "name", null: false
+ t.string "namespace", null: false
+ t.string "prefix_id"
+ t.string "resource_type", null: false
+ t.datetime "updated_at", null: false
+ t.index ["display_on"], name: "index_spree_metafield_definitions_on_display_on"
+ t.index ["namespace", "key"], name: "index_spree_metafield_definitions_on_namespace_and_key"
+ t.index ["prefix_id"], name: "index_spree_metafield_definitions_on_prefix_id", unique: true
+ t.index ["resource_type", "namespace", "key"], name: "idx_on_resource_type_namespace_key_60c784bc3e", unique: true
+ t.index ["resource_type"], name: "index_spree_metafield_definitions_on_resource_type"
+ end
+
+ create_table "spree_metafields", force: :cascade do |t|
+ t.datetime "created_at", null: false
+ t.bigint "metafield_definition_id", null: false
+ t.string "prefix_id"
+ t.bigint "resource_id", null: false
+ t.string "resource_type", null: false
+ t.string "type", null: false
+ t.datetime "updated_at", null: false
+ t.text "value"
+ t.index ["metafield_definition_id"], name: "index_spree_metafields_on_metafield_definition_id"
+ t.index ["prefix_id"], name: "index_spree_metafields_on_prefix_id", unique: true
+ t.index ["resource_type", "resource_id", "metafield_definition_id"], name: "index_metafields_on_resource_and_definition", unique: true
+ t.index ["resource_type", "resource_id"], name: "index_spree_metafields_on_resource"
+ t.index ["type"], name: "index_spree_metafields_on_type"
+ end
+
+ create_table "spree_newsletter_subscribers", force: :cascade do |t|
+ t.datetime "created_at", null: false
+ t.string "email", null: false
+ t.string "prefix_id"
+ t.jsonb "private_metadata"
+ t.jsonb "public_metadata"
+ t.datetime "updated_at", null: false
+ t.bigint "user_id"
+ t.string "verification_token"
+ t.datetime "verified_at"
+ t.index ["email"], name: "index_spree_newsletter_subscribers_on_email", unique: true
+ t.index ["prefix_id"], name: "index_spree_newsletter_subscribers_on_prefix_id", unique: true
+ t.index ["user_id"], name: "index_spree_newsletter_subscribers_on_user_id"
+ t.index ["verification_token"], name: "index_spree_newsletter_subscribers_on_verification_token", unique: true
+ t.index ["verified_at"], name: "index_spree_newsletter_subscribers_on_verified_at"
+ end
+
+ create_table "spree_option_type_prototypes", force: :cascade do |t|
+ t.datetime "created_at", precision: nil
+ t.bigint "option_type_id"
+ t.bigint "prototype_id"
+ t.datetime "updated_at", precision: nil
+ 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_type_translations", force: :cascade do |t|
+ t.datetime "created_at", null: false
+ t.string "locale", null: false
+ t.string "presentation"
+ t.bigint "spree_option_type_id", null: false
+ t.datetime "updated_at", null: false
+ t.index ["locale"], name: "index_spree_option_type_translations_on_locale"
+ t.index ["spree_option_type_id", "locale"], name: "unique_option_type_id_per_locale", unique: true
+ end
+
+ create_table "spree_option_types", force: :cascade do |t|
+ t.datetime "created_at", null: false
+ t.boolean "filterable", default: true, null: false
+ t.string "name", limit: 100
+ t.integer "position", default: 0, null: false
+ t.string "prefix_id"
+ t.string "presentation", limit: 100
+ t.jsonb "private_metadata"
+ t.jsonb "public_metadata"
+ t.datetime "updated_at", null: false
+ t.index ["filterable"], name: "index_spree_option_types_on_filterable"
+ t.index ["name"], name: "index_spree_option_types_on_name", unique: true
+ t.index ["position"], name: "index_spree_option_types_on_position"
+ t.index ["prefix_id"], name: "index_spree_option_types_on_prefix_id", unique: true
+ end
+
+ create_table "spree_option_value_translations", force: :cascade do |t|
+ t.datetime "created_at", null: false
+ t.string "locale", null: false
+ t.string "presentation"
+ t.bigint "spree_option_value_id", null: false
+ t.datetime "updated_at", null: false
+ t.index ["locale"], name: "index_spree_option_value_translations_on_locale"
+ t.index ["spree_option_value_id", "locale"], name: "unique_option_value_id_per_locale", unique: true
+ end
+
+ create_table "spree_option_value_variants", force: :cascade do |t|
+ t.datetime "created_at", precision: nil
+ t.bigint "option_value_id"
+ t.datetime "updated_at", precision: nil
+ t.bigint "variant_id"
+ 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.datetime "created_at", null: false
+ t.string "name"
+ t.bigint "option_type_id"
+ t.integer "position"
+ t.string "prefix_id"
+ t.string "presentation"
+ t.jsonb "private_metadata"
+ t.jsonb "public_metadata"
+ t.datetime "updated_at", null: false
+ t.index ["name"], name: "index_spree_option_values_on_name"
+ t.index ["option_type_id", "name"], name: "index_spree_option_values_on_option_type_id_and_name", unique: true
+ t.index ["option_type_id"], name: "index_spree_option_values_on_option_type_id"
+ t.index ["position"], name: "index_spree_option_values_on_position"
+ t.index ["prefix_id"], name: "index_spree_option_values_on_prefix_id", unique: true
+ end
+
+ create_table "spree_order_promotions", force: :cascade do |t|
+ t.datetime "created_at", precision: nil
+ t.bigint "order_id"
+ t.bigint "promotion_id"
+ t.datetime "updated_at", precision: nil
+ 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", unique: true
+ t.index ["promotion_id"], name: "index_spree_order_promotions_on_promotion_id"
+ end
+
+ create_table "spree_orders", force: :cascade do |t|
+ t.boolean "accept_marketing", default: false
+ t.decimal "additional_tax_total", precision: 10, scale: 2, default: "0.0"
+ t.decimal "adjustment_total", precision: 10, scale: 2, default: "0.0", null: false
+ t.datetime "approved_at", precision: nil
+ t.bigint "approver_id"
+ t.bigint "bill_address_id"
+ t.datetime "canceled_at", precision: nil
+ t.bigint "canceler_id"
+ t.string "channel", default: "spree"
+ t.datetime "completed_at", precision: nil
+ t.boolean "confirmation_delivered", default: false
+ t.boolean "considered_risky", default: false
+ t.datetime "created_at", null: false
+ t.bigint "created_by_id"
+ t.string "currency"
+ t.string "email"
+ t.bigint "gift_card_id"
+ t.decimal "included_tax_total", precision: 10, scale: 2, default: "0.0", null: false
+ t.text "internal_note"
+ t.integer "item_count", default: 0
+ t.decimal "item_total", precision: 10, scale: 2, default: "0.0", null: false
+ t.string "last_ip_address"
+ t.decimal "non_taxable_adjustment_total", precision: 10, scale: 2, default: "0.0", null: false
+ t.string "number", limit: 32
+ t.string "payment_state"
+ t.decimal "payment_total", precision: 10, scale: 2, default: "0.0"
+ t.string "prefix_id"
+ t.jsonb "private_metadata"
+ t.decimal "promo_total", precision: 10, scale: 2, default: "0.0"
+ t.jsonb "public_metadata"
+ t.bigint "ship_address_id"
+ t.string "shipment_state"
+ t.decimal "shipment_total", precision: 10, scale: 2, default: "0.0", null: false
+ t.boolean "signup_for_an_account", default: false
+ t.text "special_instructions"
+ t.string "state"
+ t.integer "state_lock_version", default: 0, null: false
+ t.bigint "store_id"
+ t.boolean "store_owner_notification_delivered"
+ t.decimal "taxable_adjustment_total", precision: 10, scale: 2, default: "0.0", null: false
+ t.string "token"
+ t.decimal "total", precision: 10, scale: 2, default: "0.0", null: false
+ t.datetime "updated_at", null: false
+ t.bigint "user_id"
+ 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 ["gift_card_id"], name: "index_spree_orders_on_gift_card_id"
+ t.index ["number"], name: "index_spree_orders_on_number", unique: true
+ t.index ["prefix_id"], name: "index_spree_orders_on_prefix_id", 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.datetime "created_at", null: false
+ t.bigint "payment_id"
+ t.string "prefix_id"
+ t.datetime "updated_at", null: false
+ t.index ["payment_id"], name: "index_spree_payment_capture_events_on_payment_id"
+ t.index ["prefix_id"], name: "index_spree_payment_capture_events_on_prefix_id", unique: true
+ end
+
+ create_table "spree_payment_methods", force: :cascade do |t|
+ t.boolean "active", default: true
+ t.boolean "auto_capture"
+ t.datetime "created_at", null: false
+ t.datetime "deleted_at", precision: nil
+ t.text "description"
+ t.string "display_on", default: "both"
+ t.string "name"
+ t.integer "position", default: 0
+ t.text "preferences"
+ t.string "prefix_id"
+ t.jsonb "private_metadata"
+ t.jsonb "public_metadata"
+ t.jsonb "settings"
+ t.string "type"
+ t.datetime "updated_at", null: false
+ t.index ["id", "type"], name: "index_spree_payment_methods_on_id_and_type"
+ t.index ["prefix_id"], name: "index_spree_payment_methods_on_prefix_id", unique: true
+ 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_payment_sources", force: :cascade do |t|
+ t.datetime "created_at", precision: nil, null: false
+ t.string "gateway_customer_profile_id"
+ t.string "gateway_payment_profile_id"
+ t.bigint "payment_method_id"
+ t.string "prefix_id"
+ t.jsonb "private_metadata"
+ t.jsonb "public_metadata"
+ t.string "type"
+ t.datetime "updated_at", precision: nil, null: false
+ t.bigint "user_id"
+ t.index ["payment_method_id"], name: "index_spree_payment_sources_on_payment_method_id"
+ t.index ["prefix_id"], name: "index_spree_payment_sources_on_prefix_id", unique: true
+ t.index ["type", "gateway_payment_profile_id"], name: "index_payment_sources_on_type_and_gateway_payment_profile_id", unique: true
+ t.index ["type"], name: "index_spree_payment_sources_on_type"
+ t.index ["user_id"], name: "index_spree_payment_sources_on_user_id"
+ end
+
+ create_table "spree_payments", force: :cascade do |t|
+ t.decimal "amount", precision: 10, scale: 2, default: "0.0", null: false
+ t.string "avs_response"
+ t.datetime "created_at", null: false
+ t.string "cvv_response_code"
+ t.string "cvv_response_message"
+ t.string "number"
+ t.bigint "order_id"
+ t.bigint "payment_method_id"
+ t.string "prefix_id"
+ t.jsonb "private_metadata"
+ t.jsonb "public_metadata"
+ t.string "response_code"
+ t.bigint "source_id"
+ t.string "source_type"
+ t.string "state"
+ t.datetime "updated_at", null: false
+ 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 ["prefix_id"], name: "index_spree_payments_on_prefix_id", unique: true
+ t.index ["source_id", "source_type"], name: "index_spree_payments_on_source_id_and_source_type"
+ end
+
+ create_table "spree_policies", force: :cascade do |t|
+ t.datetime "created_at", null: false
+ t.string "name"
+ t.bigint "owner_id"
+ t.string "owner_type"
+ t.string "prefix_id"
+ t.string "slug", null: false
+ t.datetime "updated_at", null: false
+ t.index ["owner_id", "owner_type", "slug"], name: "index_spree_policies_on_owner_id_and_owner_type_and_slug", unique: true
+ t.index ["owner_type", "owner_id"], name: "index_spree_policies_on_owner"
+ t.index ["prefix_id"], name: "index_spree_policies_on_prefix_id", unique: true
+ end
+
+ create_table "spree_policy_translations", force: :cascade do |t|
+ t.datetime "created_at", null: false
+ t.string "locale", null: false
+ t.string "name"
+ t.bigint "spree_policy_id", null: false
+ t.datetime "updated_at", null: false
+ t.index ["spree_policy_id", "locale"], name: "index_spree_policy_translations_on_spree_policy_id_and_locale", unique: true
+ t.index ["spree_policy_id"], name: "index_spree_policy_translations_on_spree_policy_id"
+ end
+
+ create_table "spree_post_categories", force: :cascade do |t|
+ t.datetime "created_at", null: false
+ t.string "prefix_id"
+ t.string "slug", null: false
+ t.bigint "store_id", null: false
+ t.string "title", null: false
+ t.datetime "updated_at", null: false
+ t.index ["prefix_id"], name: "index_spree_post_categories_on_prefix_id", unique: true
+ t.index ["slug", "store_id"], name: "index_spree_post_categories_on_slug_and_store_id", unique: true
+ t.index ["store_id"], name: "index_spree_post_categories_on_store_id"
+ end
+
+ create_table "spree_posts", force: :cascade do |t|
+ t.bigint "author_id"
+ t.datetime "created_at", null: false
+ t.datetime "deleted_at", precision: nil
+ t.string "meta_description"
+ t.string "meta_title"
+ t.bigint "post_category_id"
+ t.string "prefix_id"
+ t.datetime "published_at", precision: nil
+ t.string "slug", null: false
+ t.bigint "store_id"
+ t.string "title", null: false
+ t.datetime "updated_at", null: false
+ t.index ["author_id"], name: "index_spree_posts_on_author_id"
+ t.index ["post_category_id"], name: "index_spree_posts_on_post_category_id"
+ t.index ["prefix_id"], name: "index_spree_posts_on_prefix_id", unique: true
+ t.index ["store_id"], name: "index_spree_posts_on_store_id"
+ t.index ["title"], name: "index_spree_posts_on_title"
+ end
+
+ create_table "spree_preferences", force: :cascade do |t|
+ t.datetime "created_at", null: false
+ t.string "key"
+ t.datetime "updated_at", null: false
+ t.text "value"
+ t.index ["key"], name: "index_spree_preferences_on_key", unique: true
+ end
+
+ create_table "spree_price_lists", force: :cascade do |t|
+ t.datetime "created_at", null: false
+ t.datetime "deleted_at"
+ t.text "description"
+ t.datetime "ends_at"
+ t.string "match_policy", default: "all", null: false
+ t.string "name", null: false
+ t.integer "position", default: 0, null: false
+ t.string "prefix_id"
+ t.datetime "starts_at"
+ t.string "status", default: "draft", null: false
+ t.bigint "store_id", null: false
+ t.datetime "updated_at", null: false
+ t.index ["deleted_at"], name: "index_spree_price_lists_on_deleted_at"
+ t.index ["position"], name: "index_spree_price_lists_on_position"
+ t.index ["prefix_id"], name: "index_spree_price_lists_on_prefix_id", unique: true
+ t.index ["starts_at", "ends_at"], name: "index_spree_price_lists_on_starts_at_and_ends_at"
+ t.index ["status"], name: "index_spree_price_lists_on_status"
+ t.index ["store_id", "status", "position"], name: "index_spree_price_lists_on_store_id_and_status_and_position"
+ t.index ["store_id"], name: "index_spree_price_lists_on_store_id"
+ end
+
+ create_table "spree_price_rules", force: :cascade do |t|
+ t.datetime "created_at", null: false
+ t.text "preferences"
+ t.string "prefix_id"
+ t.bigint "price_list_id", null: false
+ t.string "type", null: false
+ t.datetime "updated_at", null: false
+ t.index ["prefix_id"], name: "index_spree_price_rules_on_prefix_id", unique: true
+ t.index ["price_list_id", "type"], name: "index_spree_price_rules_on_price_list_id_and_type"
+ t.index ["price_list_id"], name: "index_spree_price_rules_on_price_list_id"
+ t.index ["type"], name: "index_spree_price_rules_on_type"
+ end
+
+ create_table "spree_prices", force: :cascade do |t|
+ t.decimal "amount", precision: 10, scale: 2
+ t.decimal "compare_at_amount", precision: 10, scale: 2
+ t.datetime "created_at", precision: nil, null: false
+ t.string "currency"
+ t.datetime "deleted_at", precision: nil
+ t.string "prefix_id"
+ t.bigint "price_list_id"
+ t.datetime "updated_at", precision: nil, null: false
+ t.bigint "variant_id", null: false
+ t.index ["deleted_at"], name: "index_spree_prices_on_deleted_at"
+ t.index ["prefix_id"], name: "index_spree_prices_on_prefix_id", unique: true
+ t.index ["price_list_id"], name: "index_spree_prices_on_price_list_id"
+ t.index ["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))"
+ t.index ["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))"
+ t.index ["variant_id"], name: "index_spree_prices_on_variant_id"
+ end
+
+ create_table "spree_product_option_types", force: :cascade do |t|
+ t.datetime "created_at", null: false
+ t.bigint "option_type_id"
+ t.integer "position"
+ t.bigint "product_id"
+ t.datetime "updated_at", 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.datetime "created_at", precision: nil
+ t.bigint "product_id"
+ t.bigint "promotion_rule_id"
+ t.datetime "updated_at", precision: nil
+ t.index ["product_id", "promotion_rule_id"], name: "idx_on_product_id_promotion_rule_id_aaea0385c9", unique: true
+ 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_product_properties", force: :cascade do |t|
+ t.datetime "created_at", null: false
+ t.string "filter_param"
+ t.integer "position", default: 0
+ t.bigint "product_id"
+ t.bigint "property_id"
+ t.boolean "show_property", default: true
+ t.datetime "updated_at", null: false
+ t.string "value"
+ t.index ["filter_param"], name: "index_spree_product_properties_on_filter_param"
+ t.index ["position"], name: "index_spree_product_properties_on_position"
+ t.index ["product_id"], name: "index_product_properties_on_product_id"
+ t.index ["property_id", "product_id"], name: "index_spree_product_properties_on_property_id_and_product_id", unique: true
+ t.index ["property_id"], name: "index_spree_product_properties_on_property_id"
+ end
+
+ create_table "spree_product_property_translations", force: :cascade do |t|
+ t.datetime "created_at", null: false
+ t.string "locale", null: false
+ t.bigint "spree_product_property_id", null: false
+ t.datetime "updated_at", null: false
+ t.string "value"
+ t.index ["locale"], name: "index_spree_product_property_translations_on_locale"
+ t.index ["spree_product_property_id", "locale"], name: "unique_product_property_id_per_locale", unique: true
+ end
+
+ create_table "spree_product_translations", force: :cascade do |t|
+ t.datetime "created_at", null: false
+ t.datetime "deleted_at", precision: nil
+ t.text "description"
+ t.string "locale", null: false
+ t.text "meta_description"
+ t.string "meta_keywords"
+ t.string "meta_title"
+ t.string "name"
+ t.string "slug"
+ t.bigint "spree_product_id", null: false
+ t.datetime "updated_at", null: false
+ t.index ["deleted_at"], name: "index_spree_product_translations_on_deleted_at"
+ t.index ["locale", "slug"], name: "unique_slug_per_locale", unique: true
+ t.index ["locale"], name: "index_spree_product_translations_on_locale"
+ t.index ["spree_product_id", "locale"], name: "unique_product_id_per_locale", unique: true
+ end
+
+ create_table "spree_products", force: :cascade do |t|
+ t.datetime "available_on", precision: nil
+ t.integer "classification_count", default: 0, null: false
+ t.datetime "created_at", null: false
+ t.datetime "deleted_at", precision: nil
+ t.text "description"
+ t.datetime "discontinue_on", precision: nil
+ t.datetime "make_active_at", precision: nil
+ t.text "meta_description"
+ t.string "meta_keywords"
+ t.string "meta_title"
+ t.string "name", default: "", null: false
+ t.string "prefix_id"
+ t.jsonb "private_metadata"
+ t.boolean "promotionable", default: true
+ t.jsonb "public_metadata"
+ t.bigint "shipping_category_id"
+ t.string "slug"
+ t.string "status", default: "draft", null: false
+ t.bigint "tax_category_id"
+ t.bigint "thumbnail_id"
+ t.integer "total_image_count", default: 0, null: false
+ t.datetime "updated_at", null: false
+ t.integer "variant_count", default: 0, null: false
+ t.index ["available_on"], name: "index_spree_products_on_available_on"
+ t.index ["classification_count"], name: "index_spree_products_on_classification_count"
+ t.index ["deleted_at"], name: "index_spree_products_on_deleted_at"
+ t.index ["discontinue_on"], name: "index_spree_products_on_discontinue_on"
+ t.index ["make_active_at"], name: "index_spree_products_on_make_active_at"
+ t.index ["name"], name: "index_spree_products_on_name"
+ t.index ["prefix_id"], name: "index_spree_products_on_prefix_id", unique: true
+ t.index ["promotionable"], name: "index_spree_products_on_promotionable"
+ 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 ["status", "deleted_at"], name: "index_spree_products_on_status_and_deleted_at"
+ t.index ["status"], name: "index_spree_products_on_status"
+ t.index ["tax_category_id"], name: "index_spree_products_on_tax_category_id"
+ t.index ["thumbnail_id"], name: "index_spree_products_on_thumbnail_id"
+ t.index ["total_image_count"], name: "index_spree_products_on_total_image_count"
+ t.index ["variant_count"], name: "index_spree_products_on_variant_count"
+ end
+
+ create_table "spree_products_stores", force: :cascade do |t|
+ t.datetime "created_at", precision: nil, null: false
+ t.string "prefix_id"
+ t.bigint "product_id"
+ t.decimal "revenue", precision: 10, scale: 2, default: "0.0", null: false
+ t.bigint "store_id"
+ t.integer "units_sold_count", default: 0, null: false
+ t.datetime "updated_at", precision: nil, null: false
+ t.index ["prefix_id"], name: "index_spree_products_stores_on_prefix_id", unique: true
+ 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", "revenue"], name: "index_products_stores_on_store_and_revenue"
+ t.index ["store_id", "units_sold_count"], name: "index_products_stores_on_store_and_units_sold"
+ t.index ["store_id"], name: "index_spree_products_stores_on_store_id"
+ end
+
+ create_table "spree_products_taxons", force: :cascade do |t|
+ t.datetime "created_at", precision: nil
+ t.integer "position"
+ t.bigint "product_id"
+ t.bigint "taxon_id"
+ t.datetime "updated_at", precision: nil
+ 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.datetime "created_at", precision: nil
+ t.bigint "promotion_action_id"
+ t.integer "quantity", default: 1
+ t.datetime "updated_at", precision: nil
+ t.bigint "variant_id"
+ t.index ["promotion_action_id", "variant_id"], name: "idx_on_promotion_action_id_variant_id_90d181a88a", unique: true
+ 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.datetime "created_at", precision: nil
+ t.datetime "deleted_at", precision: nil
+ t.integer "position"
+ t.string "prefix_id"
+ t.bigint "promotion_id"
+ t.string "type"
+ t.datetime "updated_at", precision: nil
+ 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 ["prefix_id"], name: "index_spree_promotion_actions_on_prefix_id", unique: true
+ t.index ["promotion_id"], name: "index_spree_promotion_actions_on_promotion_id"
+ end
+
+ create_table "spree_promotion_categories", force: :cascade do |t|
+ t.string "code"
+ t.datetime "created_at", null: false
+ t.string "name"
+ t.string "prefix_id"
+ t.datetime "updated_at", null: false
+ t.index ["prefix_id"], name: "index_spree_promotion_categories_on_prefix_id", unique: true
+ end
+
+ create_table "spree_promotion_rule_taxons", force: :cascade do |t|
+ t.datetime "created_at", precision: nil
+ t.bigint "promotion_rule_id"
+ t.bigint "taxon_id"
+ t.datetime "updated_at", precision: nil
+ t.index ["promotion_rule_id"], name: "index_spree_promotion_rule_taxons_on_promotion_rule_id"
+ t.index ["taxon_id", "promotion_rule_id"], name: "idx_on_taxon_id_promotion_rule_id_3c91a6f5d7", unique: true
+ 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.datetime "created_at", precision: nil
+ t.bigint "promotion_rule_id"
+ t.datetime "updated_at", precision: nil
+ t.bigint "user_id"
+ t.index ["promotion_rule_id"], name: "index_promotion_rules_users_on_promotion_rule_id"
+ t.index ["user_id", "promotion_rule_id"], name: "idx_on_user_id_promotion_rule_id_ad0307a89b", unique: true
+ 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.string "code"
+ t.datetime "created_at", null: false
+ t.text "preferences"
+ t.string "prefix_id"
+ t.bigint "product_group_id"
+ t.bigint "promotion_id"
+ t.string "type"
+ t.datetime "updated_at", null: false
+ t.bigint "user_id"
+ t.index ["prefix_id"], name: "index_spree_promotion_rules_on_prefix_id", unique: true
+ 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.boolean "advertise", default: false
+ t.string "code"
+ t.string "code_prefix"
+ t.datetime "created_at", null: false
+ t.string "description"
+ t.datetime "expires_at", precision: nil
+ t.integer "kind", default: 0
+ t.string "match_policy", default: "all"
+ t.boolean "multi_codes", default: false
+ t.string "name"
+ t.integer "number_of_codes"
+ t.string "path"
+ t.string "prefix_id"
+ t.jsonb "private_metadata"
+ t.bigint "promotion_category_id"
+ t.jsonb "public_metadata"
+ t.datetime "starts_at", precision: nil
+ t.string "type"
+ t.datetime "updated_at", null: false
+ t.integer "usage_limit"
+ 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 ["kind"], name: "index_spree_promotions_on_kind"
+ t.index ["path"], name: "index_spree_promotions_on_path"
+ t.index ["prefix_id"], name: "index_spree_promotions_on_prefix_id", unique: true
+ 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.datetime "created_at", precision: nil, null: false
+ t.bigint "promotion_id"
+ t.bigint "store_id"
+ t.datetime "updated_at", precision: nil, 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_properties", force: :cascade do |t|
+ t.datetime "created_at", null: false
+ t.string "display_on", default: "both"
+ t.string "filter_param"
+ t.boolean "filterable", default: false, null: false
+ t.integer "kind", default: 0
+ t.string "name"
+ t.integer "position", default: 0
+ t.string "presentation", null: false
+ t.jsonb "private_metadata"
+ t.jsonb "public_metadata"
+ t.datetime "updated_at", null: false
+ t.index ["filter_param"], name: "index_spree_properties_on_filter_param"
+ t.index ["filterable"], name: "index_spree_properties_on_filterable"
+ t.index ["name"], name: "index_spree_properties_on_name", unique: true
+ t.index ["position"], name: "index_spree_properties_on_position"
+ end
+
+ create_table "spree_property_prototypes", force: :cascade do |t|
+ t.datetime "created_at", precision: nil
+ t.bigint "property_id"
+ t.bigint "prototype_id"
+ t.datetime "updated_at", precision: nil
+ t.index ["property_id"], name: "index_spree_property_prototypes_on_property_id"
+ t.index ["prototype_id", "property_id"], name: "index_property_prototypes_on_prototype_id_and_property_id", unique: true
+ t.index ["prototype_id"], name: "index_spree_property_prototypes_on_prototype_id"
+ end
+
+ create_table "spree_property_translations", force: :cascade do |t|
+ t.datetime "created_at", null: false
+ t.string "locale", null: false
+ t.string "presentation"
+ t.bigint "spree_property_id", null: false
+ t.datetime "updated_at", null: false
+ t.index ["locale"], name: "index_spree_property_translations_on_locale"
+ t.index ["spree_property_id", "locale"], name: "unique_property_id_per_locale", unique: true
+ end
+
+ create_table "spree_prototype_taxons", force: :cascade do |t|
+ t.datetime "created_at", precision: nil
+ t.bigint "prototype_id"
+ t.bigint "taxon_id"
+ t.datetime "updated_at", precision: nil
+ 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.datetime "created_at", null: false
+ t.string "name"
+ t.string "prefix_id"
+ t.jsonb "private_metadata"
+ t.jsonb "public_metadata"
+ t.datetime "updated_at", null: false
+ t.index ["prefix_id"], name: "index_spree_prototypes_on_prefix_id", unique: true
+ end
+
+ create_table "spree_refund_reasons", force: :cascade do |t|
+ t.boolean "active", default: true
+ t.datetime "created_at", null: false
+ t.boolean "mutable", default: true
+ t.string "name"
+ t.string "prefix_id"
+ t.datetime "updated_at", null: false
+ t.index ["name"], name: "index_spree_refund_reasons_on_name", unique: true
+ t.index ["prefix_id"], name: "index_spree_refund_reasons_on_prefix_id", unique: true
+ end
+
+ create_table "spree_refunds", force: :cascade do |t|
+ t.decimal "amount", precision: 10, scale: 2, default: "0.0", null: false
+ t.datetime "created_at", null: false
+ t.bigint "payment_id"
+ t.string "prefix_id"
+ t.jsonb "private_metadata"
+ t.jsonb "public_metadata"
+ t.bigint "refund_reason_id"
+ t.bigint "refunder_id"
+ t.bigint "reimbursement_id"
+ t.string "transaction_id"
+ t.datetime "updated_at", null: false
+ t.index ["payment_id"], name: "index_spree_refunds_on_payment_id"
+ t.index ["prefix_id"], name: "index_spree_refunds_on_prefix_id", unique: true
+ t.index ["refund_reason_id"], name: "index_refunds_on_refund_reason_id"
+ t.index ["refunder_id"], name: "index_spree_refunds_on_refunder_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.datetime "created_at", precision: nil
+ t.bigint "creditable_id"
+ t.string "creditable_type"
+ t.string "prefix_id"
+ t.bigint "reimbursement_id"
+ t.datetime "updated_at", precision: nil
+ t.index ["creditable_id", "creditable_type"], name: "index_reimbursement_credits_on_creditable_id_and_type"
+ t.index ["prefix_id"], name: "index_spree_reimbursement_credits_on_prefix_id", unique: true
+ t.index ["reimbursement_id"], name: "index_spree_reimbursement_credits_on_reimbursement_id"
+ end
+
+ create_table "spree_reimbursement_types", force: :cascade do |t|
+ t.boolean "active", default: true
+ t.datetime "created_at", null: false
+ t.boolean "mutable", default: true
+ t.string "name"
+ t.string "prefix_id"
+ t.string "type"
+ t.datetime "updated_at", null: false
+ t.index ["name"], name: "index_spree_reimbursement_types_on_name", unique: true
+ t.index ["prefix_id"], name: "index_spree_reimbursement_types_on_prefix_id", unique: true
+ t.index ["type"], name: "index_spree_reimbursement_types_on_type"
+ end
+
+ create_table "spree_reimbursements", force: :cascade do |t|
+ t.datetime "created_at", null: false
+ t.bigint "customer_return_id"
+ t.string "number"
+ t.bigint "order_id"
+ t.bigint "performed_by_id"
+ t.string "prefix_id"
+ t.string "reimbursement_status"
+ t.decimal "total", precision: 10, scale: 2
+ t.datetime "updated_at", 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"
+ t.index ["performed_by_id"], name: "index_spree_reimbursements_on_performed_by_id"
+ t.index ["prefix_id"], name: "index_spree_reimbursements_on_prefix_id", unique: true
+ end
+
+ create_table "spree_reports", force: :cascade do |t|
+ t.datetime "created_at", null: false
+ t.string "currency"
+ t.datetime "date_from", precision: nil
+ t.datetime "date_to", precision: nil
+ t.string "prefix_id"
+ t.bigint "store_id", null: false
+ t.string "type"
+ t.datetime "updated_at", null: false
+ t.bigint "user_id"
+ t.index ["prefix_id"], name: "index_spree_reports_on_prefix_id", unique: true
+ t.index ["store_id"], name: "index_spree_reports_on_store_id"
+ t.index ["user_id"], name: "index_spree_reports_on_user_id"
+ end
+
+ create_table "spree_return_authorization_reasons", force: :cascade do |t|
+ t.boolean "active", default: true
+ t.datetime "created_at", null: false
+ t.boolean "mutable", default: true
+ t.string "name"
+ t.string "prefix_id"
+ t.datetime "updated_at", null: false
+ t.index ["name"], name: "index_spree_return_authorization_reasons_on_name", unique: true
+ t.index ["prefix_id"], name: "index_spree_return_authorization_reasons_on_prefix_id", unique: true
+ end
+
+ create_table "spree_return_authorizations", force: :cascade do |t|
+ t.datetime "created_at", precision: nil
+ t.text "memo"
+ t.string "number"
+ t.bigint "order_id"
+ t.string "prefix_id"
+ t.bigint "return_authorization_reason_id"
+ t.string "state"
+ t.bigint "stock_location_id"
+ t.datetime "updated_at", precision: nil
+ 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 ["prefix_id"], name: "index_spree_return_authorizations_on_prefix_id", unique: true
+ 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.string "acceptance_status"
+ t.text "acceptance_status_errors"
+ t.decimal "additional_tax_total", precision: 12, scale: 4, default: "0.0", null: false
+ t.datetime "created_at", null: false
+ t.bigint "customer_return_id"
+ t.bigint "exchange_variant_id"
+ t.decimal "included_tax_total", precision: 12, scale: 4, default: "0.0", null: false
+ t.bigint "inventory_unit_id"
+ t.bigint "override_reimbursement_type_id"
+ t.decimal "pre_tax_amount", precision: 12, scale: 4, default: "0.0", null: false
+ t.bigint "preferred_reimbursement_type_id"
+ t.string "prefix_id"
+ t.string "reception_status"
+ t.bigint "reimbursement_id"
+ t.boolean "resellable", default: true, null: false
+ t.bigint "return_authorization_id"
+ t.datetime "updated_at", 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 ["prefix_id"], name: "index_spree_return_items_on_prefix_id", unique: true
+ 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.datetime "created_at", precision: nil
+ t.bigint "invitation_id"
+ t.bigint "resource_id"
+ t.string "resource_type"
+ t.bigint "role_id"
+ t.datetime "updated_at", precision: nil
+ t.bigint "user_id"
+ t.string "user_type", null: false
+ t.index ["invitation_id"], name: "index_spree_role_users_on_invitation_id"
+ t.index ["resource_id", "resource_type", "user_id", "user_type", "role_id"], name: "idx_on_resource_id_resource_type_user_id_user_type__5600304ec6", unique: true
+ t.index ["resource_type", "resource_id"], name: "index_spree_role_users_on_resource"
+ t.index ["role_id"], name: "index_spree_role_users_on_role_id"
+ t.index ["user_id"], name: "index_spree_role_users_on_user_id"
+ t.index ["user_type"], name: "index_spree_role_users_on_user_type"
+ end
+
+ create_table "spree_roles", force: :cascade do |t|
+ t.datetime "created_at", precision: nil
+ t.string "name"
+ t.string "prefix_id"
+ t.datetime "updated_at", precision: nil
+ t.index ["name"], name: "index_spree_roles_on_name", unique: true
+ t.index ["prefix_id"], name: "index_spree_roles_on_prefix_id", unique: true
+ end
+
+ create_table "spree_shipments", force: :cascade do |t|
+ t.decimal "additional_tax_total", precision: 10, scale: 2, default: "0.0"
+ t.bigint "address_id"
+ t.decimal "adjustment_total", precision: 10, scale: 2, default: "0.0"
+ t.decimal "cost", precision: 10, scale: 2, default: "0.0"
+ t.datetime "created_at", null: false
+ t.decimal "included_tax_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.string "number"
+ t.bigint "order_id"
+ t.decimal "pre_tax_amount", precision: 12, scale: 4, default: "0.0", null: false
+ t.string "prefix_id"
+ t.jsonb "private_metadata"
+ t.decimal "promo_total", precision: 10, scale: 2, default: "0.0"
+ t.jsonb "public_metadata"
+ t.datetime "shipped_at", precision: nil
+ t.string "state"
+ t.bigint "stock_location_id"
+ t.decimal "taxable_adjustment_total", precision: 10, scale: 2, default: "0.0", null: false
+ t.string "tracking"
+ t.datetime "updated_at", 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 ["prefix_id"], name: "index_spree_shipments_on_prefix_id", unique: true
+ t.index ["stock_location_id"], name: "index_spree_shipments_on_stock_location_id"
+ end
+
+ create_table "spree_shipping_categories", force: :cascade do |t|
+ t.datetime "created_at", null: false
+ t.string "name"
+ t.string "prefix_id"
+ t.datetime "updated_at", null: false
+ t.index ["name"], name: "index_spree_shipping_categories_on_name"
+ t.index ["prefix_id"], name: "index_spree_shipping_categories_on_prefix_id", unique: true
+ end
+
+ create_table "spree_shipping_method_categories", force: :cascade do |t|
+ t.datetime "created_at", null: false
+ t.string "prefix_id"
+ t.bigint "shipping_category_id", null: false
+ t.bigint "shipping_method_id", null: false
+ t.datetime "updated_at", null: false
+ t.index ["prefix_id"], name: "index_spree_shipping_method_categories_on_prefix_id", unique: true
+ 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.datetime "created_at", precision: nil
+ t.bigint "shipping_method_id"
+ t.datetime "updated_at", precision: nil
+ t.bigint "zone_id"
+ 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 "admin_name"
+ t.string "code"
+ t.datetime "created_at", null: false
+ t.datetime "deleted_at", precision: nil
+ t.string "display_on"
+ t.integer "estimated_transit_business_days_max"
+ t.integer "estimated_transit_business_days_min"
+ t.string "name"
+ t.string "prefix_id"
+ t.jsonb "private_metadata"
+ t.jsonb "public_metadata"
+ t.bigint "tax_category_id"
+ t.string "tracking_url"
+ t.datetime "updated_at", null: false
+ t.index ["deleted_at"], name: "index_spree_shipping_methods_on_deleted_at"
+ t.index ["prefix_id"], name: "index_spree_shipping_methods_on_prefix_id", unique: true
+ 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.decimal "cost", precision: 8, scale: 2, default: "0.0"
+ t.datetime "created_at", null: false
+ t.string "prefix_id"
+ t.boolean "selected", default: false
+ t.bigint "shipment_id"
+ t.bigint "shipping_method_id"
+ t.bigint "tax_rate_id"
+ t.datetime "updated_at", null: false
+ t.index ["prefix_id"], name: "index_spree_shipping_rates_on_prefix_id", unique: true
+ 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.datetime "created_at", null: false
+ t.string "name"
+ t.string "next_state"
+ t.string "prefix_id"
+ t.string "previous_state"
+ t.bigint "stateful_id"
+ t.string "stateful_type"
+ t.datetime "updated_at", null: false
+ t.bigint "user_id"
+ t.index ["prefix_id"], name: "index_spree_state_changes_on_prefix_id", unique: true
+ 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 "abbr"
+ t.bigint "country_id"
+ t.datetime "created_at", precision: nil
+ t.string "name"
+ t.datetime "updated_at", precision: nil
+ t.index ["country_id"], name: "index_spree_states_on_country_id"
+ end
+
+ create_table "spree_stock_items", force: :cascade do |t|
+ t.boolean "backorderable", default: false
+ t.integer "count_on_hand", default: 0, null: false
+ t.datetime "created_at", null: false
+ t.datetime "deleted_at", precision: nil
+ t.string "prefix_id"
+ t.jsonb "private_metadata"
+ t.jsonb "public_metadata"
+ t.bigint "stock_location_id"
+ t.datetime "updated_at", null: false
+ t.bigint "variant_id"
+ t.index ["backorderable"], name: "index_spree_stock_items_on_backorderable"
+ t.index ["deleted_at"], name: "index_spree_stock_items_on_deleted_at"
+ t.index ["prefix_id"], name: "index_spree_stock_items_on_prefix_id", unique: true
+ t.index ["stock_location_id", "variant_id", "deleted_at"], name: "stock_item_by_loc_var_id_deleted_at", unique: true
+ 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", "stock_location_id"], name: "index_spree_stock_items_unique_without_deleted_at", unique: true, where: "(deleted_at IS NULL)"
+ t.index ["variant_id"], name: "index_spree_stock_items_on_variant_id"
+ end
+
+ create_table "spree_stock_locations", force: :cascade do |t|
+ t.boolean "active", default: true
+ t.string "address1"
+ t.string "address2"
+ t.string "admin_name"
+ t.boolean "backorderable_default", default: false
+ t.string "city"
+ t.string "company"
+ t.bigint "country_id"
+ t.datetime "created_at", null: false
+ t.boolean "default", default: false, null: false
+ t.datetime "deleted_at", precision: nil
+ t.string "name"
+ t.string "phone"
+ t.string "prefix_id"
+ t.boolean "propagate_all_variants", default: false
+ t.bigint "state_id"
+ t.string "state_name"
+ t.datetime "updated_at", null: false
+ t.string "zipcode"
+ 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 ["deleted_at"], name: "index_spree_stock_locations_on_deleted_at"
+ t.index ["prefix_id"], name: "index_spree_stock_locations_on_prefix_id", unique: true
+ 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.string "action"
+ t.datetime "created_at", null: false
+ t.bigint "originator_id"
+ t.string "originator_type"
+ t.string "prefix_id"
+ t.integer "quantity", default: 0
+ t.bigint "stock_item_id"
+ t.datetime "updated_at", null: false
+ t.index ["originator_id", "originator_type"], name: "index_stock_movements_on_originator_id_and_originator_type"
+ t.index ["prefix_id"], name: "index_spree_stock_movements_on_prefix_id", unique: true
+ 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.datetime "created_at", null: false
+ t.bigint "destination_location_id"
+ t.string "number"
+ t.string "prefix_id"
+ t.jsonb "private_metadata"
+ t.jsonb "public_metadata"
+ t.string "reference"
+ t.bigint "source_location_id"
+ t.string "type"
+ t.datetime "updated_at", null: false
+ 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 ["prefix_id"], name: "index_spree_stock_transfers_on_prefix_id", 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.datetime "created_at", null: false
+ t.string "name"
+ t.string "prefix_id"
+ t.datetime "updated_at", null: false
+ t.index ["prefix_id"], name: "index_spree_store_credit_categories_on_prefix_id", unique: true
+ end
+
+ create_table "spree_store_credit_events", force: :cascade do |t|
+ t.string "action", null: false
+ t.decimal "amount", precision: 8, scale: 2
+ t.string "authorization_code", null: false
+ t.datetime "created_at", null: false
+ t.datetime "deleted_at", precision: nil
+ t.bigint "originator_id"
+ t.string "originator_type"
+ t.string "prefix_id"
+ t.bigint "store_credit_id", null: false
+ t.datetime "updated_at", null: false
+ t.decimal "user_total_amount", precision: 8, scale: 2, default: "0.0", null: false
+ t.index ["originator_id", "originator_type"], name: "spree_store_credit_events_originator"
+ t.index ["prefix_id"], name: "index_spree_store_credit_events_on_prefix_id", unique: true
+ 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.datetime "created_at", null: false
+ t.string "name"
+ t.string "prefix_id"
+ t.integer "priority"
+ t.datetime "updated_at", null: false
+ t.index ["prefix_id"], name: "index_spree_store_credit_types_on_prefix_id", unique: true
+ t.index ["priority"], name: "index_spree_store_credit_types_on_priority"
+ end
+
+ create_table "spree_store_credits", force: :cascade do |t|
+ t.decimal "amount", precision: 8, scale: 2, default: "0.0", null: false
+ t.decimal "amount_authorized", precision: 8, scale: 2, default: "0.0", null: false
+ t.decimal "amount_used", precision: 8, scale: 2, default: "0.0", null: false
+ t.bigint "category_id"
+ t.datetime "created_at", null: false
+ t.bigint "created_by_id"
+ t.string "currency"
+ t.datetime "deleted_at", precision: nil
+ t.text "memo"
+ t.bigint "originator_id"
+ t.string "originator_type"
+ t.string "prefix_id"
+ t.jsonb "private_metadata"
+ t.jsonb "public_metadata"
+ t.bigint "store_id"
+ t.bigint "type_id"
+ t.datetime "updated_at", null: false
+ t.bigint "user_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 ["prefix_id"], name: "index_spree_store_credits_on_prefix_id", unique: true
+ 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_store_translations", force: :cascade do |t|
+ t.text "address"
+ t.string "contact_phone"
+ t.datetime "created_at", null: false
+ t.string "customer_support_email"
+ t.datetime "deleted_at", precision: nil
+ t.text "description"
+ t.string "facebook"
+ t.string "instagram"
+ t.string "locale", null: false
+ t.text "meta_description"
+ t.text "meta_keywords"
+ t.string "name"
+ t.string "new_order_notifications_email"
+ t.string "seo_title"
+ t.bigint "spree_store_id", null: false
+ t.string "twitter"
+ t.datetime "updated_at", null: false
+ t.index ["deleted_at"], name: "index_spree_store_translations_on_deleted_at"
+ t.index ["locale"], name: "index_spree_store_translations_on_locale"
+ t.index ["spree_store_id", "locale"], name: "index_spree_store_translations_on_spree_store_id_locale", unique: true
+ end
+
+ create_table "spree_stores", force: :cascade do |t|
+ t.text "address"
+ t.bigint "checkout_zone_id"
+ t.string "code"
+ t.string "contact_phone"
+ t.datetime "created_at", null: false
+ t.string "customer_support_email"
+ t.boolean "default", default: false, null: false
+ t.bigint "default_country_id"
+ t.string "default_currency"
+ t.string "default_locale"
+ t.datetime "deleted_at", precision: nil
+ t.text "description"
+ t.string "facebook"
+ t.string "instagram"
+ t.string "mail_from_address"
+ t.text "meta_description"
+ t.text "meta_keywords"
+ t.string "name"
+ t.string "new_order_notifications_email"
+ t.text "preferences"
+ t.string "prefix_id"
+ t.jsonb "private_metadata"
+ t.jsonb "public_metadata"
+ t.string "seo_robots"
+ t.string "seo_title"
+ t.jsonb "settings"
+ t.text "storefront_custom_code_body_end"
+ t.text "storefront_custom_code_body_start"
+ t.text "storefront_custom_code_head"
+ t.string "supported_currencies"
+ t.string "supported_locales"
+ t.string "twitter"
+ t.datetime "updated_at", null: false
+ t.string "url"
+ t.index ["code"], name: "index_spree_stores_on_code", unique: true
+ t.index ["default"], name: "index_spree_stores_on_default"
+ t.index ["deleted_at"], name: "index_spree_stores_on_deleted_at"
+ t.index ["prefix_id"], name: "index_spree_stores_on_prefix_id", unique: true
+ t.index ["url"], name: "index_spree_stores_on_url"
+ end
+
+ create_table "spree_taggings", force: :cascade do |t|
+ t.string "context", limit: 128
+ t.datetime "created_at", precision: nil
+ t.bigint "tag_id"
+ t.bigint "taggable_id"
+ t.string "taggable_type"
+ t.bigint "tagger_id"
+ t.string "tagger_type"
+ 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", force: :cascade do |t|
+ t.datetime "created_at", null: false
+ t.string "name"
+ t.integer "taggings_count", default: 0
+ t.datetime "updated_at", null: false
+ t.index "lower((name)::text) varchar_pattern_ops", name: "index_spree_tags_on_lower_name"
+ t.index ["name"], name: "index_spree_tags_on_name", unique: true
+ end
+
+ create_table "spree_tax_categories", force: :cascade do |t|
+ t.datetime "created_at", null: false
+ t.datetime "deleted_at", precision: nil
+ t.string "description"
+ t.boolean "is_default", default: false
+ t.string "name"
+ t.string "prefix_id"
+ t.string "tax_code"
+ t.datetime "updated_at", null: false
+ t.index ["deleted_at"], name: "index_spree_tax_categories_on_deleted_at"
+ t.index ["is_default"], name: "index_spree_tax_categories_on_is_default"
+ t.index ["prefix_id"], name: "index_spree_tax_categories_on_prefix_id", unique: true
+ end
+
+ create_table "spree_tax_rates", force: :cascade do |t|
+ t.decimal "amount", precision: 8, scale: 5
+ t.datetime "created_at", null: false
+ t.datetime "deleted_at", precision: nil
+ t.boolean "included_in_price", default: false
+ t.string "name"
+ t.string "prefix_id"
+ t.jsonb "private_metadata"
+ t.jsonb "public_metadata"
+ t.boolean "show_rate_in_label", default: true
+ t.bigint "tax_category_id"
+ t.datetime "updated_at", null: false
+ t.bigint "zone_id"
+ 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 ["prefix_id"], name: "index_spree_tax_rates_on_prefix_id", unique: true
+ 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_taxon_rules", force: :cascade do |t|
+ t.datetime "created_at", null: false
+ t.string "match_policy", default: "is_equal_to", null: false
+ t.string "prefix_id"
+ t.bigint "taxon_id", null: false
+ t.string "type", null: false
+ t.datetime "updated_at", null: false
+ t.string "value", null: false
+ t.index ["prefix_id"], name: "index_spree_taxon_rules_on_prefix_id", unique: true
+ t.index ["taxon_id"], name: "index_spree_taxon_rules_on_taxon_id"
+ end
+
+ create_table "spree_taxon_translations", force: :cascade do |t|
+ t.datetime "created_at", null: false
+ t.text "description"
+ t.string "locale", null: false
+ t.string "meta_description"
+ t.string "meta_keywords"
+ t.string "meta_title"
+ t.string "name"
+ t.string "permalink"
+ t.string "pretty_name"
+ t.bigint "spree_taxon_id", null: false
+ t.datetime "updated_at", null: false
+ t.index ["locale"], name: "index_spree_taxon_translations_on_locale"
+ t.index ["pretty_name"], name: "index_spree_taxon_translations_on_pretty_name"
+ t.index ["spree_taxon_id", "locale"], name: "index_spree_taxon_translations_on_spree_taxon_id_and_locale", unique: true
+ end
+
+ create_table "spree_taxonomies", force: :cascade do |t|
+ t.datetime "created_at", null: false
+ t.string "name", null: false
+ t.integer "position", default: 0
+ t.string "prefix_id"
+ t.jsonb "private_metadata"
+ t.jsonb "public_metadata"
+ t.bigint "store_id"
+ t.datetime "updated_at", null: false
+ 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 ["prefix_id"], name: "index_spree_taxonomies_on_prefix_id", unique: true
+ t.index ["store_id"], name: "index_spree_taxonomies_on_store_id"
+ end
+
+ create_table "spree_taxonomy_translations", force: :cascade do |t|
+ t.datetime "created_at", null: false
+ t.string "locale", null: false
+ t.string "name"
+ t.bigint "spree_taxonomy_id", null: false
+ t.datetime "updated_at", null: false
+ t.index ["locale"], name: "index_spree_taxonomy_translations_on_locale"
+ t.index ["spree_taxonomy_id", "locale"], name: "index_spree_taxonomy_translations_on_spree_taxonomy_id_locale", unique: true
+ end
+
+ create_table "spree_taxons", force: :cascade do |t|
+ t.boolean "automatic", default: false, null: false
+ t.integer "children_count", default: 0, null: false
+ t.integer "classification_count", default: 0, null: false
+ t.datetime "created_at", null: false
+ t.integer "depth"
+ t.text "description"
+ t.boolean "hide_from_nav", default: false
+ t.bigint "lft"
+ t.string "meta_description"
+ t.string "meta_keywords"
+ t.string "meta_title"
+ t.string "name", null: false
+ t.bigint "parent_id"
+ t.string "permalink"
+ t.integer "position", default: 0
+ t.string "prefix_id"
+ t.string "pretty_name"
+ t.jsonb "private_metadata"
+ t.jsonb "public_metadata"
+ t.bigint "rgt"
+ t.string "rules_match_policy", default: "all", null: false
+ t.string "sort_order", default: "manual", null: false
+ t.bigint "taxonomy_id"
+ t.datetime "updated_at", null: false
+ t.index ["children_count"], name: "index_spree_taxons_on_children_count"
+ t.index ["classification_count"], name: "index_spree_taxons_on_classification_count"
+ 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 ["prefix_id"], name: "index_spree_taxons_on_prefix_id", unique: true
+ t.index ["pretty_name"], name: "index_spree_taxons_on_pretty_name"
+ 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.boolean "active", default: true
+ t.string "analytics_id"
+ t.datetime "created_at", null: false
+ t.integer "engine", default: 0, null: false
+ t.datetime "updated_at", null: false
+ t.index ["active"], name: "index_spree_trackers_on_active"
+ end
+
+ create_table "spree_user_identities", force: :cascade do |t|
+ t.string "access_token"
+ t.datetime "created_at", null: false
+ t.datetime "expires_at"
+ t.json "info"
+ t.string "prefix_id"
+ t.string "provider", null: false
+ t.string "refresh_token"
+ t.string "uid", null: false
+ t.datetime "updated_at", null: false
+ t.bigint "user_id", null: false
+ t.string "user_type", null: false
+ t.index ["prefix_id"], name: "index_spree_user_identities_on_prefix_id", unique: true
+ t.index ["provider", "uid", "user_type"], name: "index_spree_user_identities_on_provider_uid_user_type", unique: true
+ t.index ["user_type", "user_id"], name: "index_spree_user_identities_on_user"
+ end
+
+ create_table "spree_users", force: :cascade do |t|
+ t.boolean "accepts_email_marketing", default: false, null: false
+ t.string "authentication_token"
+ t.bigint "bill_address_id"
+ t.datetime "created_at", null: false
+ t.datetime "current_sign_in_at", precision: nil
+ t.string "current_sign_in_ip"
+ t.string "email"
+ t.string "encrypted_password", limit: 128
+ t.integer "failed_attempts", default: 0, null: false
+ t.string "first_name"
+ t.string "last_name"
+ t.datetime "last_request_at", precision: nil
+ t.datetime "last_sign_in_at", precision: nil
+ t.string "last_sign_in_ip"
+ t.datetime "locked_at", precision: nil
+ t.string "login"
+ t.string "password_salt", limit: 128
+ t.string "perishable_token"
+ t.string "persistence_token"
+ t.string "phone"
+ t.string "prefix_id"
+ t.jsonb "private_metadata"
+ t.jsonb "public_metadata"
+ t.datetime "remember_created_at", precision: nil
+ t.string "remember_token"
+ t.datetime "reset_password_sent_at", precision: nil
+ t.string "reset_password_token"
+ t.string "selected_locale"
+ t.bigint "ship_address_id"
+ t.integer "sign_in_count", default: 0, null: false
+ t.string "unlock_token"
+ t.datetime "updated_at", null: false
+ t.index ["accepts_email_marketing"], name: "index_spree_users_on_accepts_email_marketing"
+ t.index ["bill_address_id"], name: "index_spree_users_on_bill_address_id"
+ t.index ["prefix_id"], name: "index_spree_users_on_prefix_id", unique: true
+ t.index ["ship_address_id"], name: "index_spree_users_on_ship_address_id"
+ end
+
+ create_table "spree_variants", force: :cascade do |t|
+ t.string "barcode"
+ t.string "cost_currency"
+ t.decimal "cost_price", precision: 10, scale: 2
+ t.datetime "created_at", precision: nil, null: false
+ t.datetime "deleted_at", precision: nil
+ t.decimal "depth", precision: 8, scale: 2
+ t.string "dimensions_unit"
+ t.datetime "discontinue_on", precision: nil
+ t.decimal "height", precision: 8, scale: 2
+ t.integer "image_count", default: 0, null: false
+ t.boolean "is_master", default: false
+ t.integer "position"
+ t.string "prefix_id"
+ t.jsonb "private_metadata"
+ t.bigint "product_id"
+ t.jsonb "public_metadata"
+ t.string "sku", default: "", null: false
+ t.bigint "tax_category_id"
+ t.bigint "thumbnail_id"
+ t.boolean "track_inventory", default: true
+ t.datetime "updated_at", precision: nil, null: false
+ t.decimal "weight", precision: 8, scale: 2, default: "0.0"
+ t.string "weight_unit"
+ t.decimal "width", precision: 8, scale: 2
+ t.index ["barcode"], name: "index_spree_variants_on_barcode"
+ t.index ["deleted_at"], name: "index_spree_variants_on_deleted_at"
+ t.index ["discontinue_on"], name: "index_spree_variants_on_discontinue_on"
+ t.index ["image_count"], name: "index_spree_variants_on_image_count"
+ t.index ["is_master"], name: "index_spree_variants_on_is_master"
+ t.index ["position"], name: "index_spree_variants_on_position"
+ t.index ["prefix_id"], name: "index_spree_variants_on_prefix_id", unique: true
+ 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 ["thumbnail_id"], name: "index_spree_variants_on_thumbnail_id"
+ t.index ["track_inventory"], name: "index_spree_variants_on_track_inventory"
+ end
+
+ create_table "spree_webhook_deliveries", force: :cascade do |t|
+ t.datetime "created_at", null: false
+ t.datetime "delivered_at"
+ t.string "error_type"
+ t.string "event_name", null: false
+ t.integer "execution_time"
+ t.jsonb "payload", null: false
+ t.string "prefix_id"
+ t.text "request_errors"
+ t.text "response_body"
+ t.integer "response_code"
+ t.boolean "success"
+ t.datetime "updated_at", null: false
+ t.bigint "webhook_endpoint_id", null: false
+ t.index ["delivered_at"], name: "index_spree_webhook_deliveries_on_delivered_at"
+ t.index ["event_name"], name: "index_spree_webhook_deliveries_on_event_name"
+ t.index ["prefix_id"], name: "index_spree_webhook_deliveries_on_prefix_id", unique: true
+ t.index ["response_code"], name: "index_spree_webhook_deliveries_on_response_code"
+ t.index ["success"], name: "index_spree_webhook_deliveries_on_success"
+ t.index ["webhook_endpoint_id"], name: "index_spree_webhook_deliveries_on_webhook_endpoint_id"
+ end
+
+ create_table "spree_webhook_endpoints", force: :cascade do |t|
+ t.boolean "active", default: true, null: false
+ t.datetime "created_at", null: false
+ t.datetime "deleted_at"
+ t.string "prefix_id"
+ t.string "secret_key", null: false
+ t.bigint "store_id", null: false
+ t.jsonb "subscriptions", null: false
+ t.datetime "updated_at", null: false
+ t.string "url", null: false
+ t.index ["active"], name: "index_spree_webhook_endpoints_on_active"
+ t.index ["deleted_at"], name: "index_spree_webhook_endpoints_on_deleted_at"
+ t.index ["prefix_id"], name: "index_spree_webhook_endpoints_on_prefix_id", unique: true
+ t.index ["store_id"], name: "index_spree_webhook_endpoints_on_store_id"
+ end
+
+ create_table "spree_wished_items", force: :cascade do |t|
+ t.datetime "created_at", precision: nil, null: false
+ t.string "prefix_id"
+ t.integer "quantity", default: 1, null: false
+ t.datetime "updated_at", precision: nil, null: false
+ t.bigint "variant_id"
+ t.bigint "wishlist_id"
+ t.index ["prefix_id"], name: "index_spree_wished_items_on_prefix_id", unique: true
+ t.index ["variant_id", "wishlist_id"], name: "index_spree_wished_items_on_variant_id_and_wishlist_id", unique: true
+ t.index ["variant_id"], name: "index_spree_wished_items_on_variant_id"
+ t.index ["wishlist_id"], name: "index_spree_wished_items_on_wishlist_id"
+ end
+
+ create_table "spree_wishlists", force: :cascade do |t|
+ t.datetime "created_at", precision: nil, null: false
+ t.boolean "is_default", default: false, null: false
+ t.boolean "is_private", default: true, null: false
+ t.string "name"
+ t.string "prefix_id"
+ t.bigint "store_id"
+ t.string "token", null: false
+ t.datetime "updated_at", precision: nil, null: false
+ t.bigint "user_id"
+ t.index ["prefix_id"], name: "index_spree_wishlists_on_prefix_id", unique: true
+ t.index ["store_id"], name: "index_spree_wishlists_on_store_id"
+ t.index ["token"], name: "index_spree_wishlists_on_token", unique: true
+ t.index ["user_id", "is_default"], name: "index_spree_wishlists_on_user_id_and_is_default"
+ t.index ["user_id"], name: "index_spree_wishlists_on_user_id"
+ end
+
+ create_table "spree_zone_members", force: :cascade do |t|
+ t.datetime "created_at", null: false
+ t.datetime "updated_at", null: false
+ t.bigint "zone_id"
+ t.bigint "zoneable_id"
+ t.string "zoneable_type"
+ 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.datetime "created_at", null: false
+ t.boolean "default_tax", default: false
+ t.string "description"
+ t.string "kind", default: "state"
+ t.string "name"
+ t.string "prefix_id"
+ t.datetime "updated_at", null: false
+ t.integer "zone_members_count", default: 0
+ t.index ["default_tax"], name: "index_spree_zones_on_default_tax"
+ t.index ["kind"], name: "index_spree_zones_on_kind"
+ t.index ["prefix_id"], name: "index_spree_zones_on_prefix_id", unique: true
+ end
+
+ add_foreign_key "active_storage_attachments", "active_storage_blobs", column: "blob_id"
+ add_foreign_key "active_storage_variant_records", "active_storage_blobs", column: "blob_id"
+ add_foreign_key "spree_option_type_translations", "spree_option_types"
+ add_foreign_key "spree_option_value_translations", "spree_option_values"
+ add_foreign_key "spree_payment_sources", "spree_payment_methods", column: "payment_method_id"
+ add_foreign_key "spree_payment_sources", "spree_users", column: "user_id"
+ add_foreign_key "spree_product_property_translations", "spree_product_properties"
+ add_foreign_key "spree_product_translations", "spree_products"
+ add_foreign_key "spree_property_translations", "spree_properties"
+ add_foreign_key "spree_store_translations", "spree_stores"
+ add_foreign_key "spree_taxon_translations", "spree_taxons"
+ add_foreign_key "spree_taxonomy_translations", "spree_taxonomies"
end
diff --git a/backend/db/seeds.rb b/backend/db/seeds.rb
index 4fbd6ed970..a7416153d3 100644
--- a/backend/db/seeds.rb
+++ b/backend/db/seeds.rb
@@ -7,3 +7,5 @@
# ["Action", "Comedy", "Drama", "Horror"].each do |genre_name|
# MovieGenre.find_or_create_by!(name: genre_name)
# end
+
+Spree::Core::Engine.load_seed if defined?(Spree::Core)
diff --git a/backend/lib/spree/authentication_helpers.rb b/backend/lib/spree/authentication_helpers.rb
new file mode 100644
index 0000000000..331cb30d22
--- /dev/null
+++ b/backend/lib/spree/authentication_helpers.rb
@@ -0,0 +1,50 @@
+module Spree
+ module AuthenticationHelpers
+ def self.included(receiver)
+ receiver.helper_method(
+ :spree_current_user,
+ :spree_login_path,
+ :spree_signup_path,
+ :spree_logout_path,
+ :spree_forgot_password_path,
+ :spree_edit_password_path,
+ :spree_admin_login_path,
+ :spree_admin_logout_path
+ )
+ end
+
+ def spree_current_user
+ send("current_#{Spree.user_class.model_name.singular_route_key}")
+ end
+
+ def spree_login_path(opts = {})
+ new_session_path(Spree.user_class.model_name.singular_route_key, opts)
+ end
+
+ def spree_signup_path(opts = {})
+ new_registration_path(Spree.user_class.model_name.singular_route_key, opts)
+ end
+
+ def spree_logout_path(opts = {})
+ destroy_session_path(Spree.user_class.model_name.singular_route_key, opts)
+ end
+
+ def spree_forgot_password_path(opts = {})
+ new_password_path(Spree.user_class.model_name.singular_route_key, opts)
+ end
+
+ def spree_edit_password_path(opts = {})
+ edit_registration_path(Spree.user_class.model_name.singular_route_key, opts)
+ end
+
+ def spree_admin_login_path(opts = {})
+ new_session_path(Spree.admin_user_class.model_name.singular_route_key, opts)
+ end
+
+ def spree_admin_logout_path(opts = {})
+ destroy_session_path(Spree.admin_user_class.model_name.singular_route_key, opts)
+ end
+ end
+end
+
+ApplicationController.include Spree::AuthenticationHelpers if defined?(ApplicationController)