From 817bf4caa1457c2b65331c1cc266a9de30a0d5c0 Mon Sep 17 00:00:00 2001 From: Pau Perez Date: Wed, 9 Jan 2019 18:56:40 +0100 Subject: [PATCH] Explain why a index forbids more than a location --- ...094641_add_uniqueness_of_variant_id_to_spree_stock_items.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/db/migrate/20180906094641_add_uniqueness_of_variant_id_to_spree_stock_items.rb b/db/migrate/20180906094641_add_uniqueness_of_variant_id_to_spree_stock_items.rb index bc7713f428..93b2853208 100644 --- a/db/migrate/20180906094641_add_uniqueness_of_variant_id_to_spree_stock_items.rb +++ b/db/migrate/20180906094641_add_uniqueness_of_variant_id_to_spree_stock_items.rb @@ -1,3 +1,6 @@ +# Since OFN has only a single default StockLocation, variants in OFN can only +# have a stock item. By adding this unique index we constraint that at DB level +# ensuring data integrity. class AddUniquenessOfVariantIdToSpreeStockItems < ActiveRecord::Migration def change add_index :spree_stock_items, :variant_id, unique: true