From 1f2a21ef58a45ff289f0dfdc582df20573150d05 Mon Sep 17 00:00:00 2001 From: soky srm Date: Tue, 11 Nov 2025 13:33:06 +0100 Subject: [PATCH] Remove migration file Signed-off-by: soky srm --- ...4519_remove_orphaned_lunchflow_accounts.rb | 28 ------------------- 1 file changed, 28 deletions(-) delete mode 100644 db/migrate/20251111084519_remove_orphaned_lunchflow_accounts.rb diff --git a/db/migrate/20251111084519_remove_orphaned_lunchflow_accounts.rb b/db/migrate/20251111084519_remove_orphaned_lunchflow_accounts.rb deleted file mode 100644 index 80a210854..000000000 --- a/db/migrate/20251111084519_remove_orphaned_lunchflow_accounts.rb +++ /dev/null @@ -1,28 +0,0 @@ -class RemoveOrphanedLunchflowAccounts < ActiveRecord::Migration[7.2] - def up - # Find all LunchflowAccount records that don't have an associated account_provider - # These are "orphaned" accounts that were created during sync but never actually - # imported/linked by the user due to old behavior that saved all accounts - orphaned_accounts = LunchflowAccount.left_outer_joins(:account_provider) - .where(account_providers: { id: nil }) - - orphaned_count = orphaned_accounts.count - - if orphaned_count > 0 - Rails.logger.info "Removing #{orphaned_count} orphaned LunchflowAccount records (not linked via account_provider)" - - # Delete orphaned accounts - orphaned_accounts.destroy_all - - Rails.logger.info "Successfully removed #{orphaned_count} orphaned LunchflowAccount records" - else - Rails.logger.info "No orphaned LunchflowAccount records found to remove" - end - end - - def down - # Cannot restore orphaned accounts that were deleted - # These were unused accounts from old behavior that shouldn't have been created - Rails.logger.info "Cannot restore orphaned LunchflowAccount records (data migration is irreversible)" - end -end