php - Updating PK values mysql -
i have 2 tables wish update articles
, articles_entities
articles has pk of id
, articles_entities has fk article_id
both these fields char(36) uuid. looking convert these fields int(10).
is there way can update 2 tables 1 query , key keys matching? or have write script through each articles , update references?
i using innodb if helps.
two steps:
ensure foreign key set "on update cascade", update mother table's id field contains numbers. on update cascade constraint have innodb update child table updates mother... if have lot of rows, prepared extremely slow.
change type of both columns int. may need drop foreign key before , re-create afterwards.
Comments
Post a Comment