Unsupported Screen Size: The viewport size is too small for the theme to render properly.

Backup Database As Sql Dump And Foreign Keys

forums forums SQLyog SQLyog: Bugs / Feature Requests Backup Database As Sql Dump And Foreign Keys

  • This topic is empty.
Viewing 1 reply thread
  • Author
    Posts
    • #10320
      tyrathect
      Member

      When using the option “Backup Database as SQL Dump”, the CREATE TABLE statements are exported in alphabetical order. If there are foreign keys on those tables, this will most likely cause problems when trying to execute the generated script.

      For example, I have two tables “mail” (storing data about an email to be sent) and “attachments” (attachments for mails in the “mail” table). The “attachments” table has a foreign key referring to an entry in the “mail” table. Using “Backup Table…”, due to the alphabetical ordering, the statement “CREATE TABLE `attachments`…” appears before “CREATE TABLE `mail`…”, so the first statement fails because the second would have been to be executed before.

    • #23933
      peterlaursen
      Participant

      If you have Foreign Keys you should use the option to

      SET FOREIGN_KEYS_CHECK = 0

      This is the standard way to handle this problem everywhere you copy/export/sync tables with Foreign Keys.

Viewing 1 reply thread
  • You must be logged in to reply to this topic.