Initial commit - fresh start

This commit is contained in:
Ubuntu
2025-10-27 04:04:54 +00:00
parent a659275fb6
commit 52ab5d1005
265 changed files with 188424 additions and 64 deletions

View File

@@ -0,0 +1,44 @@
# frozen_string_literal: true
class DeviseCreateSpreeUsers < ActiveRecord::Migration[7.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

View File

@@ -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

View File

@@ -0,0 +1,20 @@
# This migration comes from action_mailbox (originally 20180917164000)
class CreateActionMailboxTables < ActiveRecord::Migration[6.0]
def change
create_table :action_mailbox_inbound_emails, id: primary_key_type do |t|
t.integer :status, default: 0, null: false
t.string :message_id, null: false
t.string :message_checksum, null: false
t.timestamps
t.index [ :message_id, :message_checksum ], name: "index_action_mailbox_inbound_emails_uniqueness", unique: true
end
end
private
def primary_key_type
config = Rails.configuration.generators
config.options[config.orm][:primary_key_type] || :primary_key
end
end

View File

@@ -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

View File

@@ -0,0 +1,44 @@
# frozen_string_literal: true
class DeviseCreateSpreeAdminUsers < ActiveRecord::Migration[8.0]
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

File diff suppressed because it is too large Load Diff

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -0,0 +1,12 @@
# This migration comes from spree (originally 20230110142344)
class BackfillFriendlyIdSlugLocale < ActiveRecord::Migration[6.1]
def up
if Spree::Store.default.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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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, where: 'deleted_at IS NULL' }
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

View File

@@ -0,0 +1,15 @@
# 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
Spree::Promotion.reset_column_information
# set all promotions without a code to automatic
Spree::Promotion.where(code: [nil, '']).update_all(kind: 1)
end
end

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -0,0 +1,81 @@
# This migration comes from spree (originally 20250120094216)
class CreatePageBuilderModels < ActiveRecord::Migration[6.1]
def change
if !table_exists?(:spree_themes)
create_table :spree_themes do |t|
t.string :name
t.references :store, null: false, index: true
t.boolean :default, default: false, null: false
t.boolean :ready, default: true
t.string :type, default: 'Spree::Themes::Default', null: false
t.references :parent
t.text :preferences
t.timestamps
t.datetime :deleted_at
t.index ['deleted_at'], name: 'index_spree_themes_on_deleted_at'
t.index ['store_id', 'default'], name: 'index_spree_themes_on_store_id_and_default', unique: true, where: "((deleted_at IS NULL) AND (\"default\" = true))"
end
create_table :spree_pages do |t|
t.references :pageable, polymorphic: true, null: false
t.string :type, null: false
t.string :slug
t.string :name, null: false
t.string :meta_title
t.string :meta_description
t.string :meta_keywords
t.references :parent
t.text :preferences
t.timestamps
t.datetime :deleted_at
t.index ['pageable_id', 'name'], name: 'index_spree_pages_on_pageable_id_and_name'
t.index ['pageable_id', 'pageable_type', 'slug'], name: 'index_spree_pages_on_pageable_id_and_pageable_type_and_slug', unique: true, where: '((deleted_at IS NULL) AND (slug IS NOT NULL))'
t.index ['pageable_id', 'pageable_type', 'type'], name: 'index_spree_pages_on_pageable_id_and_pageable_type_and_type'
t.index ['pageable_id', 'pageable_type'], name: 'index_spree_pages_on_pageable_id_and_pageable_type'
end
create_table :spree_page_sections do |t|
t.references :pageable, polymorphic: true, null: false, index: true
t.string :type, null: false
t.string :name, null: false
t.integer :position, default: 1, null: false
t.integer :page_links_count, default: 0
t.text :preferences
t.timestamps
t.datetime :deleted_at
t.index ['pageable_id', 'pageable_type', 'position'], name: 'index_spree_page_sections_on_pageable_w_position'
end
create_table :spree_page_blocks do |t|
t.references :section, null: false, index: true
t.string :name, null: false
t.integer :position, default: 1, null: false
t.string :type, null: false
t.integer :page_links_count, default: 0
t.text :preferences
t.timestamps
t.datetime :deleted_at
t.index ['section_id', 'position'], name: 'index_spree_page_blocks_on_section_w_position'
end
create_table :spree_page_links do |t|
t.references :parent, polymorphic: true, index: true
t.references :linkable, polymorphic: true, index: true
t.string :label
t.string :url
t.boolean :open_in_new_tab, default: false
t.integer :position, default: 1, null: false
t.timestamps
end
end
end
end

View File

@@ -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

View File

@@ -0,0 +1,35 @@
# 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 ['slug', 'store_id'], name: 'index_spree_posts_on_slug_and_store_id', unique: true, where: '(deleted_at IS NULL)'
t.index ['title'], name: 'index_spree_posts_on_title'
end
end
end
end

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -0,0 +1,8 @@
# This migration comes from spree_api (originally 20100107141738)
class AddApiKeyToSpreeUsers < ActiveRecord::Migration[4.2]
def change
unless defined?(User)
add_column :spree_users, :api_key, :string, limit: 40
end
end
end

View File

@@ -0,0 +1,8 @@
# This migration comes from spree_api (originally 20120411123334)
class ResizeApiKeyField < ActiveRecord::Migration[4.2]
def change
unless defined?(User)
change_column :spree_users, :api_key, :string, limit: 48
end
end
end

View File

@@ -0,0 +1,8 @@
# This migration comes from spree_api (originally 20120530054546)
class RenameApiKeyToSpreeApiKey < ActiveRecord::Migration[4.2]
def change
unless defined?(User)
rename_column :spree_users, :api_key, :spree_api_key
end
end
end

View File

@@ -0,0 +1,8 @@
# This migration comes from spree_api (originally 20131017162334)
class AddIndexToUserSpreeApiKey < ActiveRecord::Migration[4.2]
def change
unless defined?(User)
add_index :spree_users, :spree_api_key
end
end
end

View File

@@ -0,0 +1,70 @@
# This migration comes from spree_api (originally 20180320110726)
class CreateDoorkeeperTables < ActiveRecord::Migration[5.1]
def change
create_table :spree_oauth_applications do |t|
t.string :name, null: false
t.string :uid, null: false
t.string :secret, null: false
t.text :redirect_uri, null: false
t.string :scopes, null: false, default: ''
t.boolean :confidential, null: false, default: true
t.timestamps null: false
end
add_index :spree_oauth_applications, :uid, unique: true
create_table :spree_oauth_access_grants do |t|
t.integer :resource_owner_id, null: false
t.references :application, null: false
t.string :token, null: false
t.integer :expires_in, null: false
t.text :redirect_uri, null: false
t.datetime :created_at, null: false
t.datetime :revoked_at
t.string :scopes
end
add_index :spree_oauth_access_grants, :token, unique: true
add_foreign_key(
:spree_oauth_access_grants,
:spree_oauth_applications,
column: :application_id
)
create_table :spree_oauth_access_tokens do |t|
t.integer :resource_owner_id
t.references :application
# If you use a custom token generator you may need to change this column
# from string to text, so that it accepts tokens larger than 255
# characters. More info on custom token generators in:
# https://github.com/doorkeeper-gem/doorkeeper/tree/v3.0.0.rc1#custom-access-token-generator
#
# t.text :token, null: false
t.string :token, null: false
t.string :refresh_token
t.integer :expires_in
t.datetime :revoked_at
t.datetime :created_at, null: false
t.string :scopes
# If there is a previous_refresh_token column,
# refresh tokens will be revoked after a related access token is used.
# If there is no previous_refresh_token column,
# previous tokens are revoked as soon as a new access token is created.
# Comment out this line if you'd rather have refresh tokens
# instantly revoked.
t.string :previous_refresh_token, null: false, default: ""
end
add_index :spree_oauth_access_tokens, :token, unique: true
add_index :spree_oauth_access_tokens, :resource_owner_id
add_index :spree_oauth_access_tokens, :refresh_token, unique: true
add_foreign_key(
:spree_oauth_access_tokens,
:spree_oauth_applications,
column: :application_id
)
end
end

View File

@@ -0,0 +1,10 @@
# This migration comes from spree_api (originally 20210727102516)
class ChangeIntegerIdColumnsType < ActiveRecord::Migration[5.2]
def change
change_column :spree_oauth_access_grants, :resource_owner_id, :bigint
change_column :spree_oauth_access_grants, :application_id, :bigint
change_column :spree_oauth_access_tokens, :resource_owner_id, :bigint
change_column :spree_oauth_access_tokens, :application_id, :bigint
end
end

View File

@@ -0,0 +1,17 @@
# This migration comes from spree_api (originally 20210902162826)
class CreateSpreeWebhooksTables < ActiveRecord::Migration[5.2]
def change
create_table :spree_webhooks_subscribers do |t|
t.string :url, null: false
t.boolean :active, default: false, index: true
if t.respond_to? :jsonb
t.jsonb :subscriptions
else
t.json :subscriptions
end
t.timestamps
end
end
end

View File

@@ -0,0 +1,22 @@
# This migration comes from spree_api (originally 20210919183228)
class EnablePolymorphicResourceOwner < ActiveRecord::Migration[5.2]
def change
add_column :spree_oauth_access_tokens, :resource_owner_type, :string
add_column :spree_oauth_access_grants, :resource_owner_type, :string
change_column_null :spree_oauth_access_grants, :resource_owner_type, false
add_index :spree_oauth_access_tokens,
[:resource_owner_id, :resource_owner_type],
name: 'polymorphic_owner_oauth_access_tokens'
add_index :spree_oauth_access_grants,
[:resource_owner_id, :resource_owner_type],
name: 'polymorphic_owner_oauth_access_grants'
Spree::OauthAccessToken.reset_column_information
Spree::OauthAccessToken.update_all(resource_owner_type: Spree.user_class)
Spree::OauthAccessGrant.reset_column_information
Spree::OauthAccessGrant.update_all(resource_owner_type: Spree.user_class)
end
end

View File

@@ -0,0 +1,15 @@
# This migration comes from spree_api (originally 20211025162826)
class CreateSpreeWebhooksEvents < ActiveRecord::Migration[5.2]
def change
create_table :spree_webhooks_events do |t|
t.integer "execution_time"
t.string "name", null: false
t.string "request_errors"
t.string "response_code", index: true
t.belongs_to "subscriber", null: false, index: true
t.boolean "success", index: true
t.string "url", null: false
t.timestamps
end
end
end

Some files were not shown because too many files have changed in this diff Show More