I have in my MYSQL table a unique key and i want to add to it.
UNIQUE KEY `user_id` (`user_id`,`account_id`)
and i want to add another
UNIQUE KEY `user_id` (`user_id`,`account_id`,`pet_id`)
ALTER TABLE your_table
DROP INDEX user_id,
ADD UNIQUE KEY `user_id` (`user_id`,`account_id`,`pet_id`)
I use this code to change field 'uniq_key' which empty
UPDATE your_table SET `uniq_key`= CONCAT(`user_id`, account_id, pet_id) WHERE `uniq_key`= ''