From ad51b41bb3789dbb5d52b798e01d972e9fdbaed4 Mon Sep 17 00:00:00 2001 From: Cillian O'Ruanaidh Date: Thu, 30 Jun 2022 11:55:26 +0100 Subject: [PATCH] Use :belongs_to instead of :references in :order_cycles_shipping_methods Also fix migration class name. --- ...29092052_create_order_cycles_shipping_methods.rb | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/db/migrate/20220429092052_create_order_cycles_shipping_methods.rb b/db/migrate/20220429092052_create_order_cycles_shipping_methods.rb index a4596d69d4..7f184a8571 100644 --- a/db/migrate/20220429092052_create_order_cycles_shipping_methods.rb +++ b/db/migrate/20220429092052_create_order_cycles_shipping_methods.rb @@ -1,13 +1,12 @@ -class CreateOrderCycleShippingMethods < ActiveRecord::Migration[6.1] +class CreateOrderCyclesShippingMethods < ActiveRecord::Migration[6.1] def up create_table :order_cycles_shipping_methods, id: false do |t| - t.references :order_cycle - t.references :shipping_method, foreign_key: { to_table: :spree_shipping_methods } + t.belongs_to :order_cycle + t.belongs_to :shipping_method, foreign_key: { to_table: :spree_shipping_methods } + t.index [:order_cycle_id, :shipping_method_id], + name: "order_cycles_shipping_methods_join_index", + unique: true end - add_index :order_cycles_shipping_methods, - [:order_cycle_id, :shipping_method_id], - name: "order_cycles_shipping_methods_join_index", - unique: true end def down