开发者

Export and import foreign Keys

We've tranfered a site to a new server and now it's been running for th开发者_开发知识库ree days without any foreign keys being active.

How can I:

  1. Export the foreign keys from the old structure (100+ tables)
  2. Import the keys while ignoring integrity problems
  3. Discard all the records where the foreign key are missing


  1. Create two dumps (current/imported) and use a database diff tool, or generate the alter table statements by pulling the data from the information schema.

  2. SET foreign_key_checks = 0; to disable, SET foreign_key_checks = 1; to enable.

  3. Use left join statements and search for null values in the outer table.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜