-- Final workaround: Disable foreign key checks, drop index, then re-enable
-- Run these commands in order:

-- STEP 1: Disable foreign key checks (this allows dropping indexes even with FK constraints)
SET FOREIGN_KEY_CHECKS = 0;

-- STEP 2: Drop the unique index (this should work now)
ALTER TABLE `bids` DROP INDEX `bids_inquiry_id_supplier_id`;

-- STEP 3: Re-enable foreign key checks
SET FOREIGN_KEY_CHECKS = 1;

-- STEP 4: Recreate foreign keys (for data integrity)
-- These don't need to be unique, so we can recreate them as regular foreign keys
ALTER TABLE `bids` 
  ADD CONSTRAINT `bids_inquiryId_fk` FOREIGN KEY (`inquiryId`) REFERENCES `inquiries` (`id`) ON DELETE CASCADE;

ALTER TABLE `bids` 
  ADD CONSTRAINT `bids_supplierId_fk` FOREIGN KEY (`supplierId`) REFERENCES `suppliers` (`id`) ON DELETE CASCADE;

-- STEP 5: Verify the index is gone and only non-unique index remains
SHOW INDEX FROM `bids` WHERE Column_name IN ('inquiryId', 'supplierId');
-- Should only see Non_unique = 1 (idx_bids_inquiry_supplier already exists)

