-- Exact solution based on your table structure
-- The unique index is: bids_inquiry_id_supplier_id
-- We need to find and drop the foreign key first

-- STEP 1: Find the foreign key constraint that uses bids_inquiry_id_supplier_id
-- Run this to see all foreign keys:
SELECT 
    CONSTRAINT_NAME,
    COLUMN_NAME,
    REFERENCED_TABLE_NAME
FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE
WHERE TABLE_SCHEMA = DATABASE()
  AND TABLE_NAME = 'bids'
  AND COLUMN_NAME IN ('inquiryId', 'supplierId')
  AND REFERENCED_TABLE_NAME IS NOT NULL;

-- STEP 2: Once you have the CONSTRAINT_NAME(s), drop them:
-- Replace 'FK_NAME' with the actual constraint name from Step 1
-- ALTER TABLE `bids` DROP FOREIGN KEY `FK_NAME`;

-- STEP 3: Now drop the unique index:
ALTER TABLE `bids` DROP INDEX `bids_inquiry_id_supplier_id`;

-- STEP 4: Recreate foreign keys (for data integrity):
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 non-unique index idx_bids_inquiry_supplier already exists, so you're good!)
SHOW INDEX FROM `bids` WHERE Column_name IN ('inquiryId', 'supplierId');
-- Should only see Non_unique = 1 (no unique index)

