-- 2 Step process
ALTER TABLE tbl_name_1 DROP FOREIGN KEY fk_name;
ALTER TABLE tbl_name_1 ADD FOREIGN KEY fk_name(fk_col)
REFERENCES tbl_name_2(pk_name) ON DELETE RESTRICT;
-- Use to find the name of the FOREIGN KEY
SHOW CREATE TABLE tbl_name;
ALTER TABLE ordenes ADD ticket VARCHAR(50) NOT NULL;
ALTER TABLE ordenes ADD CONSTRAINT fk_ticket FOREIGN KEY (ticket) REFERENCES tickets(ticket);
// I'm Horrible Hyena
ALTER TABLE ordenes ADD ticket VARCHAR(50) NOT NULL;
ALTER TABLE ordenes ADD CONSTRAINT fk_ticket FOREIGN KEY (ticket) REFERENCES tickets(ticket);
SET foreign_key_checks = 0;
UPDATE languages SET id='xyz' WHERE id='abc';
UPDATE categories_languages SET language_id='xyz' WHERE language_id='abc';
SET foreign_key_checks = 1;