-- FIXED Migration: Allow multiple bids from the same supplier
-- Follow these steps in order

-- STEP 1: Find the unique index name
-- Run this first to see what indexes exist:
SHOW INDEX FROM `bids` WHERE Column_name IN ('inquiryId', 'supplierId');

-- Look for a Key_name that appears for BOTH inquiryId and supplierId
-- and where Non_unique = 0 (meaning it's UNIQUE)
-- Note down the Key_name value

-- STEP 2: Drop the unique index
-- Replace 'YOUR_INDEX_NAME' below with the Key_name from Step 1
-- Common names might be:
--   - The table name + column names
--   - Just the column names combined
--   - A constraint name

-- Uncomment and modify the line below with your actual index name:
-- ALTER TABLE `bids` DROP INDEX `YOUR_INDEX_NAME`;

-- STEP 3: Create a non-unique index (allows duplicates)
-- NOTE: If you get error "#1061 - Duplicate key name 'idx_bids_inquiry_supplier'"
-- that means the non-unique index already exists - SKIP THIS STEP!

-- Only run this if the index doesn't exist:
-- CREATE INDEX `idx_bids_inquiry_supplier` ON `bids` (`inquiryId`, `supplierId`);

-- STEP 4: Verify
-- Run this to confirm the index is now non-unique (Non_unique should be 1)
SHOW INDEX FROM `bids` WHERE Column_name IN ('inquiryId', 'supplierId');

-- You should see Non_unique = 1, which means duplicates are now allowed!

