-- IMPORTANT: Drop the UNIQUE index, NOT the non-unique one!
-- The unique index is: bids_inquiry_id_supplier_id
-- The non-unique index (keep this): idx_bids_inquiry_supplier

-- STEP 1: Find foreign keys
SELECT CONSTRAINT_NAME, COLUMN_NAME
FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE
WHERE TABLE_SCHEMA = DATABASE()
  AND TABLE_NAME = 'bids'
  AND REFERENCED_TABLE_NAME IS NOT NULL;

-- STEP 2: Drop foreign keys (use names from Step 1)
-- ALTER TABLE `bids` DROP FOREIGN KEY `FK_NAME`;

-- STEP 3: Drop the UNIQUE index (this is the one we want to remove)
ALTER TABLE `bids` DROP INDEX `bids_inquiry_id_supplier_id`;

-- STEP 4: Keep the non-unique index idx_bids_inquiry_supplier (don't drop this!)

-- STEP 5: Recreate 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;

