diff --git a/db/migrate/20230917233937_add_foreign_key_to_spree_stock_movements_stock_item.rb b/db/migrate/20230917233937_add_foreign_key_to_spree_stock_movements_stock_item.rb deleted file mode 100644 index 37077a760d..0000000000 --- a/db/migrate/20230917233937_add_foreign_key_to_spree_stock_movements_stock_item.rb +++ /dev/null @@ -1,6 +0,0 @@ -class AddForeignKeyToSpreeStockMovementsSpreeStockItems < ActiveRecord::Migration[6.0] - def change - add_foreign_key :spree_stock_movements, :spree_stock_items, column: :stock_item_id - end -end - diff --git a/db/migrate/20230919020427_add_foreign_key_to_enterprises_spree_business_addresses.rb b/db/migrate/20230919020427_add_foreign_key_to_enterprises_spree_business_addresses.rb deleted file mode 100755 index 365d3d53ea..0000000000 --- a/db/migrate/20230919020427_add_foreign_key_to_enterprises_spree_business_addresses.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddForeignKeyToTagRulesEnterprises < ActiveRecord::Migration[6.0] - def change - add_foreign_key :enterprises, :spree_addresses, column: :business_address_id - end -end diff --git a/db/migrate/20230919020427_add_foreign_key_to_inventory_items_enterprises.rb b/db/migrate/20230919020427_add_foreign_key_to_inventory_items_enterprises.rb deleted file mode 100644 index 788d358d88..0000000000 --- a/db/migrate/20230919020427_add_foreign_key_to_inventory_items_enterprises.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddForeignKeyToInventoryItemsEnterprises < ActiveRecord::Migration[6.0] - def change - add_foreign_key :inventory_items, :enterprises, column: :enterprise_id, on_delete: :cascade - end -end diff --git a/db/migrate/20230919020427_add_foreign_key_to_inventory_items_spree_variants.rb b/db/migrate/20230919020427_add_foreign_key_to_inventory_items_spree_variants.rb deleted file mode 100644 index 03dcdc3b01..0000000000 --- a/db/migrate/20230919020427_add_foreign_key_to_inventory_items_spree_variants.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddForeignKeyToInventoryItemsSpreeVariants < ActiveRecord::Migration[6.0] - def change - add_foreign_key :inventory_items, :spree_variants, column: :variant_id, on_delete: :cascade - end -end diff --git a/db/migrate/20230919020427_add_foreign_key_to_report_rendering_options_spree_users.rb b/db/migrate/20230919020427_add_foreign_key_to_report_rendering_options_spree_users.rb deleted file mode 100644 index 8b15a2a19f..0000000000 --- a/db/migrate/20230919020427_add_foreign_key_to_report_rendering_options_spree_users.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddForeignKeyToReportRenderingOptionsSpreeUsers < ActiveRecord::Migration[6.0] - def change - add_foreign_key :report_rendering_options, :spree_users, column: :user_id, on_delete: :cascade - end -end diff --git a/db/migrate/20230919020427_add_foreign_key_to_spree_shipments_spree_stock_locations.rb b/db/migrate/20230919020427_add_foreign_key_to_spree_shipments_spree_stock_locations.rb deleted file mode 100644 index 286f8ab557..0000000000 --- a/db/migrate/20230919020427_add_foreign_key_to_spree_shipments_spree_stock_locations.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddForeignKeyToSpreeShipmentsSpreeStockLocations < ActiveRecord::Migration[6.0] - def change - add_foreign_key :spree_shipments, :spree_stock_locations, column: :stock_location_id - end -end diff --git a/db/migrate/20230919020427_add_foreign_key_to_spree_shipping_method_categories_spree_shipping_categories.rb b/db/migrate/20230919020427_add_foreign_key_to_spree_shipping_method_categories_spree_shipping_categories.rb deleted file mode 100644 index 1ae8101ab1..0000000000 --- a/db/migrate/20230919020427_add_foreign_key_to_spree_shipping_method_categories_spree_shipping_categories.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddForeignKeyToSpreeShippingMethodCategoriesSpreeShippingCategories < ActiveRecord::Migration[6.0] - def change - add_foreign_key :spree_shipping_method_categories, :spree_shipping_categories, column: :shipping_category_id, on_delete: :cascade - end -end diff --git a/db/migrate/20230919020427_add_foreign_key_to_spree_shipping_method_categories_spree_shipping_methods.rb b/db/migrate/20230919020427_add_foreign_key_to_spree_shipping_method_categories_spree_shipping_methods.rb deleted file mode 100644 index 8c85ce4838..0000000000 --- a/db/migrate/20230919020427_add_foreign_key_to_spree_shipping_method_categories_spree_shipping_methods.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddForeignKeyToSpreeShippingMethodCategoriesSpreeShippingMethods < ActiveRecord::Migration[6.0] - def change - add_foreign_key :spree_shipping_method_categories, :spree_shipping_methods, column: :shipping_method_id, on_delete: :cascade - end -end diff --git a/db/migrate/20230919020427_add_foreign_key_to_spree_stock_items_spree_stock_locations.rb b/db/migrate/20230919020427_add_foreign_key_to_spree_stock_items_spree_stock_locations.rb deleted file mode 100644 index 46da5b0488..0000000000 --- a/db/migrate/20230919020427_add_foreign_key_to_spree_stock_items_spree_stock_locations.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddForeignKeyToSpreeStockItemsSpreeStockLocations < ActiveRecord::Migration[6.0] - def change - add_foreign_key :spree_stock_items, :spree_stock_locations, column: :stock_location_id - end -end diff --git a/db/migrate/20230919020427_add_foreign_key_to_spree_stock_items_spree_variants.rb b/db/migrate/20230919020427_add_foreign_key_to_spree_stock_items_spree_variants.rb deleted file mode 100644 index a6a155f04d..0000000000 --- a/db/migrate/20230919020427_add_foreign_key_to_spree_stock_items_spree_variants.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddForeignKeyToSpreeStockItemsSpreeVariants < ActiveRecord::Migration[6.0] - def change - add_foreign_key :spree_stock_items, :spree_variants, column: :variant_id - end -end diff --git a/db/migrate/20230919020427_add_foreign_key_to_spree_stock_locations_spree_countries.rb b/db/migrate/20230919020427_add_foreign_key_to_spree_stock_locations_spree_countries.rb deleted file mode 100644 index 3b81fd7e3d..0000000000 --- a/db/migrate/20230919020427_add_foreign_key_to_spree_stock_locations_spree_countries.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddForeignKeyToSpreeStockLocationsSpreeCountries < ActiveRecord::Migration[6.0] - def change - add_foreign_key :spree_stock_locations, :spree_countries, column: :country_id - end -end diff --git a/db/migrate/20230919020427_add_foreign_key_to_spree_stock_locations_spree_states.rb b/db/migrate/20230919020427_add_foreign_key_to_spree_stock_locations_spree_states.rb deleted file mode 100644 index 9d40230986..0000000000 --- a/db/migrate/20230919020427_add_foreign_key_to_spree_stock_locations_spree_states.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddForeignKeyToSpreeStockLocationsSpreeStates < ActiveRecord::Migration[6.0] - def change - add_foreign_key :spree_stock_locations, :spree_states, column: :state_id - end -end diff --git a/db/migrate/20230919020427_add_foreign_key_to_spree_stock_movements_spree_stock_items.rb b/db/migrate/20230919020427_add_foreign_key_to_spree_stock_movements_spree_stock_items.rb deleted file mode 100644 index b7930cd92f..0000000000 --- a/db/migrate/20230919020427_add_foreign_key_to_spree_stock_movements_spree_stock_items.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddForeignKeyToSpreeStockMovementsSpreeStockItems < ActiveRecord::Migration[6.0] - def change - add_foreign_key :spree_stock_movements, :spree_stock_items, column: :stock_item_id - end -end diff --git a/db/migrate/20230919020427_add_foreign_key_to_stripe_accounts_enterprises.rb b/db/migrate/20230919020427_add_foreign_key_to_stripe_accounts_enterprises.rb deleted file mode 100644 index 1a4bc4efb7..0000000000 --- a/db/migrate/20230919020427_add_foreign_key_to_stripe_accounts_enterprises.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddForeignKeyToStripeAccountsEnterprises < ActiveRecord::Migration[6.0] - def change - add_foreign_key :stripe_accounts, :enterprises, column: :enterprise_id - end -end diff --git a/db/migrate/20230919020427_add_foreign_key_to_tag_rules_enterprises.rb b/db/migrate/20230919020427_add_foreign_key_to_tag_rules_enterprises.rb deleted file mode 100644 index b0248d3ee6..0000000000 --- a/db/migrate/20230919020427_add_foreign_key_to_tag_rules_enterprises.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddForeignKeyToTagRulesEnterprises < ActiveRecord::Migration[6.0] - def change - add_foreign_key :tag_rules, :enterprises, column: :enterprise_id - end -end diff --git a/db/migrate/20231002000136871_add_foreign_key_to_spree_stock_items_spree_stock_locations.rb b/db/migrate/20231002000136871_add_foreign_key_to_spree_stock_items_spree_stock_locations.rb new file mode 100644 index 0000000000..c04bd62183 --- /dev/null +++ b/db/migrate/20231002000136871_add_foreign_key_to_spree_stock_items_spree_stock_locations.rb @@ -0,0 +1,15 @@ +# Orphaned records can be found before running this migration with the following SQL: + +# SELECT COUNT(*) +# FROM spree_stock_items +# LEFT JOIN spree_stock_locations +# ON spree_stock_items.stock_location_id = spree_stock_locations.id +# WHERE spree_stock_locations.id IS NULL +# AND spree_stock_items.stock_location_id IS NOT NULL + + +class AddForeignKeyToSpreeStockItemsSpreeStockLocations < ActiveRecord::Migration[6.0] + def change + add_foreign_key :spree_stock_items, :spree_stock_locations, column: :stock_location_id + end +end diff --git a/db/migrate/20231002000136872_add_foreign_key_to_spree_stock_items_spree_variants.rb b/db/migrate/20231002000136872_add_foreign_key_to_spree_stock_items_spree_variants.rb new file mode 100644 index 0000000000..92a61999fe --- /dev/null +++ b/db/migrate/20231002000136872_add_foreign_key_to_spree_stock_items_spree_variants.rb @@ -0,0 +1,15 @@ +# Orphaned records can be found before running this migration with the following SQL: + +# SELECT COUNT(*) +# FROM spree_stock_items +# LEFT JOIN spree_variants +# ON spree_stock_items.variant_id = spree_variants.id +# WHERE spree_variants.id IS NULL +# AND spree_stock_items.variant_id IS NOT NULL + + +class AddForeignKeyToSpreeStockItemsSpreeVariants < ActiveRecord::Migration[6.0] + def change + add_foreign_key :spree_stock_items, :spree_variants, column: :variant_id + end +end diff --git a/db/migrate/20231002000136876_add_foreign_key_to_spree_shipping_method_categories_spree_shipping_methods.rb b/db/migrate/20231002000136876_add_foreign_key_to_spree_shipping_method_categories_spree_shipping_methods.rb new file mode 100644 index 0000000000..7e93aa1533 --- /dev/null +++ b/db/migrate/20231002000136876_add_foreign_key_to_spree_shipping_method_categories_spree_shipping_methods.rb @@ -0,0 +1,15 @@ +# Orphaned records can be found before running this migration with the following SQL: + +# SELECT COUNT(*) +# FROM spree_shipping_method_categories +# LEFT JOIN spree_shipping_methods +# ON spree_shipping_method_categories.shipping_method_id = spree_shipping_methods.id +# WHERE spree_shipping_methods.id IS NULL +# AND spree_shipping_method_categories.shipping_method_id IS NOT NULL + + +class AddForeignKeyToSpreeShippingMethodCategoriesSpreeShippingMethods < ActiveRecord::Migration[6.0] + def change + add_foreign_key :spree_shipping_method_categories, :spree_shipping_methods, column: :shipping_method_id + end +end diff --git a/db/migrate/20231002000136877_add_foreign_key_to_spree_shipping_method_categories_spree_shipping_categories.rb b/db/migrate/20231002000136877_add_foreign_key_to_spree_shipping_method_categories_spree_shipping_categories.rb new file mode 100644 index 0000000000..a27225972f --- /dev/null +++ b/db/migrate/20231002000136877_add_foreign_key_to_spree_shipping_method_categories_spree_shipping_categories.rb @@ -0,0 +1,15 @@ +# Orphaned records can be found before running this migration with the following SQL: + +# SELECT COUNT(*) +# FROM spree_shipping_method_categories +# LEFT JOIN spree_shipping_categories +# ON spree_shipping_method_categories.shipping_category_id = spree_shipping_categories.id +# WHERE spree_shipping_categories.id IS NULL +# AND spree_shipping_method_categories.shipping_category_id IS NOT NULL + + +class AddForeignKeyToSpreeShippingMethodCategoriesSpreeShippingCategories < ActiveRecord::Migration[6.0] + def change + add_foreign_key :spree_shipping_method_categories, :spree_shipping_categories, column: :shipping_category_id + end +end diff --git a/db/migrate/20231002000136879_add_foreign_key_to_report_rendering_options_spree_users.rb b/db/migrate/20231002000136879_add_foreign_key_to_report_rendering_options_spree_users.rb new file mode 100644 index 0000000000..0ec5f3c789 --- /dev/null +++ b/db/migrate/20231002000136879_add_foreign_key_to_report_rendering_options_spree_users.rb @@ -0,0 +1,15 @@ +# Orphaned records can be found before running this migration with the following SQL: + +# SELECT COUNT(*) +# FROM report_rendering_options +# LEFT JOIN spree_users +# ON report_rendering_options.user_id = spree_users.id +# WHERE spree_users.id IS NULL +# AND report_rendering_options.user_id IS NOT NULL + + +class AddForeignKeyToReportRenderingOptionsSpreeUsers < ActiveRecord::Migration[6.0] + def change + add_foreign_key :report_rendering_options, :spree_users, column: :user_id + end +end diff --git a/db/migrate/20231002000136926_add_foreign_key_to_tag_rules_enterprises.rb b/db/migrate/20231002000136926_add_foreign_key_to_tag_rules_enterprises.rb new file mode 100644 index 0000000000..6bdcc8c716 --- /dev/null +++ b/db/migrate/20231002000136926_add_foreign_key_to_tag_rules_enterprises.rb @@ -0,0 +1,15 @@ +# Orphaned records can be found before running this migration with the following SQL: + +# SELECT COUNT(*) +# FROM tag_rules +# LEFT JOIN enterprises +# ON tag_rules.enterprise_id = enterprises.id +# WHERE enterprises.id IS NULL +# AND tag_rules.enterprise_id IS NOT NULL + + +class AddForeignKeyToTagRulesEnterprises < ActiveRecord::Migration[6.0] + def change + add_foreign_key :tag_rules, :enterprises, column: :enterprise_id + end +end diff --git a/db/migrate/20231002000136952_add_foreign_key_to_spree_stock_movements_spree_stock_items.rb b/db/migrate/20231002000136952_add_foreign_key_to_spree_stock_movements_spree_stock_items.rb new file mode 100644 index 0000000000..1610ec33c2 --- /dev/null +++ b/db/migrate/20231002000136952_add_foreign_key_to_spree_stock_movements_spree_stock_items.rb @@ -0,0 +1,15 @@ +# Orphaned records can be found before running this migration with the following SQL: + +# SELECT COUNT(*) +# FROM spree_stock_movements +# LEFT JOIN spree_stock_items +# ON spree_stock_movements.stock_item_id = spree_stock_items.id +# WHERE spree_stock_items.id IS NULL +# AND spree_stock_movements.stock_item_id IS NOT NULL + + +class AddForeignKeyToSpreeStockMovementsSpreeStockItems < ActiveRecord::Migration[6.0] + def change + add_foreign_key :spree_stock_movements, :spree_stock_items, column: :stock_item_id + end +end diff --git a/db/migrate/20231002000136955_add_foreign_key_to_spree_stock_locations_spree_states.rb b/db/migrate/20231002000136955_add_foreign_key_to_spree_stock_locations_spree_states.rb new file mode 100644 index 0000000000..78dd65bedd --- /dev/null +++ b/db/migrate/20231002000136955_add_foreign_key_to_spree_stock_locations_spree_states.rb @@ -0,0 +1,15 @@ +# Orphaned records can be found before running this migration with the following SQL: + +# SELECT COUNT(*) +# FROM spree_stock_locations +# LEFT JOIN spree_states +# ON spree_stock_locations.state_id = spree_states.id +# WHERE spree_states.id IS NULL +# AND spree_stock_locations.state_id IS NOT NULL + + +class AddForeignKeyToSpreeStockLocationsSpreeStates < ActiveRecord::Migration[6.0] + def change + add_foreign_key :spree_stock_locations, :spree_states, column: :state_id + end +end diff --git a/db/migrate/20231002000136959_add_foreign_key_to_spree_stock_locations_spree_countries.rb b/db/migrate/20231002000136959_add_foreign_key_to_spree_stock_locations_spree_countries.rb new file mode 100644 index 0000000000..82f14a57f3 --- /dev/null +++ b/db/migrate/20231002000136959_add_foreign_key_to_spree_stock_locations_spree_countries.rb @@ -0,0 +1,15 @@ +# Orphaned records can be found before running this migration with the following SQL: + +# SELECT COUNT(*) +# FROM spree_stock_locations +# LEFT JOIN spree_countries +# ON spree_stock_locations.country_id = spree_countries.id +# WHERE spree_countries.id IS NULL +# AND spree_stock_locations.country_id IS NOT NULL + + +class AddForeignKeyToSpreeStockLocationsSpreeCountries < ActiveRecord::Migration[6.0] + def change + add_foreign_key :spree_stock_locations, :spree_countries, column: :country_id + end +end diff --git a/db/migrate/20231002000136976_add_foreign_key_to_spree_shipments_spree_stock_locations.rb b/db/migrate/20231002000136976_add_foreign_key_to_spree_shipments_spree_stock_locations.rb new file mode 100644 index 0000000000..c1f59bfb7f --- /dev/null +++ b/db/migrate/20231002000136976_add_foreign_key_to_spree_shipments_spree_stock_locations.rb @@ -0,0 +1,15 @@ +# Orphaned records can be found before running this migration with the following SQL: + +# SELECT COUNT(*) +# FROM spree_shipments +# LEFT JOIN spree_stock_locations +# ON spree_shipments.stock_location_id = spree_stock_locations.id +# WHERE spree_stock_locations.id IS NULL +# AND spree_shipments.stock_location_id IS NOT NULL + + +class AddForeignKeyToSpreeShipmentsSpreeStockLocations < ActiveRecord::Migration[6.0] + def change + add_foreign_key :spree_shipments, :spree_stock_locations, column: :stock_location_id + end +end diff --git a/db/migrate/20231002000137115_add_foreign_key_to_inventory_items_enterprises.rb b/db/migrate/20231002000137115_add_foreign_key_to_inventory_items_enterprises.rb new file mode 100644 index 0000000000..6095e2a996 --- /dev/null +++ b/db/migrate/20231002000137115_add_foreign_key_to_inventory_items_enterprises.rb @@ -0,0 +1,15 @@ +# Orphaned records can be found before running this migration with the following SQL: + +# SELECT COUNT(*) +# FROM inventory_items +# LEFT JOIN enterprises +# ON inventory_items.enterprise_id = enterprises.id +# WHERE enterprises.id IS NULL +# AND inventory_items.enterprise_id IS NOT NULL + + +class AddForeignKeyToInventoryItemsEnterprises < ActiveRecord::Migration[6.0] + def change + add_foreign_key :inventory_items, :enterprises, column: :enterprise_id + end +end diff --git a/db/migrate/20231002000137116_add_foreign_key_to_inventory_items_spree_variants.rb b/db/migrate/20231002000137116_add_foreign_key_to_inventory_items_spree_variants.rb new file mode 100644 index 0000000000..1c23245aee --- /dev/null +++ b/db/migrate/20231002000137116_add_foreign_key_to_inventory_items_spree_variants.rb @@ -0,0 +1,15 @@ +# Orphaned records can be found before running this migration with the following SQL: + +# SELECT COUNT(*) +# FROM inventory_items +# LEFT JOIN spree_variants +# ON inventory_items.variant_id = spree_variants.id +# WHERE spree_variants.id IS NULL +# AND inventory_items.variant_id IS NOT NULL + + +class AddForeignKeyToInventoryItemsSpreeVariants < ActiveRecord::Migration[6.0] + def change + add_foreign_key :inventory_items, :spree_variants, column: :variant_id + end +end