Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

Fix length constraints on `friendly_id_slugs` indexes (#13333)

Łukasz Adamczykdf400d3557c2
diff --git a/core/db/migrate/20251201172118_fix_indexes_on_friendly_id_slugs.rb b/core/db/migrate/20251201172118_fix_indexes_on_friendly_id_slugs.rb
new file mode 100644
index 0000000000..3fa7bdf414
--- /dev/null
+++ b/core/db/migrate/20251201172118_fix_indexes_on_friendly_id_slugs.rb
@@ -0,0 +1,8 @@
+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