-- Simple migration to allow multiple bids from the same supplier for the same inquiry
-- This removes the unique constraint on (inquiryId, supplierId)

-- Step 1: Check what indexes exist on inquiryId and supplierId
-- Run this first to see the actual index name:
SHOW INDEX FROM `bids` WHERE Column_name IN ('inquiryId', 'supplierId');

-- Step 2: Drop the unique index
-- The index name is usually based on the column names or a constraint name
-- Try these one by one until one works (ignore errors if index doesn't exist):

-- Option A: Common Sequelize-generated index name
ALTER TABLE `bids` DROP INDEX `bids_inquiryId_supplierId_unique`;

-- Option B: Alternative common name
ALTER TABLE `bids` DROP INDEX `bids_inquiryId_supplierId`;

-- Option C: If the above don't work, check Step 1 output and use the actual index name
-- It might be something like 'inquiryId_supplierId' or similar

-- Step 3: Create a non-unique index for better query performance
-- (This will fail if index already exists, which is fine - just means it's already there)
CREATE INDEX `idx_bids_inquiry_supplier` ON `bids` (`inquiryId`, `supplierId`);

-- Step 4: Verify - should show NON_UNIQUE = 1 (meaning NOT unique, allows duplicates)
SHOW INDEX FROM `bids` WHERE Column_name IN ('inquiryId', 'supplierId');

