ALTER TABLE vn.collectionWagonTicket DROP FOREIGN KEY collectionWagonTicket_ticket; ALTER TABLE vn.collectionWagonTicket DROP PRIMARY KEY; ALTER TABLE vn.collectionWagonTicket ADD CONSTRAINT collectionWagonTicket_PK PRIMARY KEY (ticketFk,trayFk); ALTER TABLE vn.collectionWagonTicket ADD CONSTRAINT collectionWagonTicket_FK FOREIGN KEY (ticketFk) REFERENCES vn.ticket(id) ON DELETE RESTRICT ON UPDATE CASCADE;