-- Find all foreign keys on the bids table
-- Run this to see ALL foreign key constraints:

SELECT 
    kcu.CONSTRAINT_NAME,
    kcu.COLUMN_NAME,
    kcu.REFERENCED_TABLE_NAME,
    kcu.REFERENCED_COLUMN_NAME
FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE kcu
WHERE kcu.TABLE_SCHEMA = DATABASE()
  AND kcu.TABLE_NAME = 'bids'
  AND kcu.REFERENCED_TABLE_NAME IS NOT NULL
ORDER BY kcu.CONSTRAINT_NAME, kcu.ORDINAL_POSITION;

-- This should show you the foreign key constraint names
-- Use those names to drop them:

-- ALTER TABLE `bids` DROP FOREIGN KEY `CONSTRAINT_NAME_FROM_ABOVE`;

-- After dropping ALL foreign keys, then:
-- ALTER TABLE `bids` DROP INDEX `bids_inquiry_id_supplier_id`;

-- Then 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;

