How did I solve «Failed to add the foreign key constraint 'SEARCH_QUERY_STORE_ID_STORE_STORE_ID' to system tables» on `bin/magento setup:upgrade`?

Failed to add the foreign key constraint 'SEARCH_QUERY_STORE_ID_STORE_STORE_ID' to system tables, query was: ALTER TABLE search_query ADD CONSTRAINT SEARCH_QUERY_STORE_ID_STORE_STORE_ID FOREIGN KEY (store_id) REFERENCES store (store_id) ON DELETE CASCADE

Step 1

SELECT TABLE_NAME 
FROM information_schema.key_column_usage 
WHERE CONSTRAINT_NAME = 'SEARCH_QUERY_STORE_ID_STORE_STORE_ID' 
AND TABLE_SCHEMA = DATABASE();

2026-05-07--09-54-22

Step 2

DROP TABLE search_query_backup_20250909;