tencent cloud

Feedback

Foreign Key Dependency Check

Last updated: 2022-09-02 15:04:25

    MySQL/MariaDB/Percona/TDSQL-C/TDSQL for MySQL Check Details

    • Foreign key dependency can only be set to only NO ACTION or RESTRICT.
    • During partial table migration, tables with foreign key dependency must be migrated.

    TDSQL for MySQL (TDStore Edition) Check Details

    Foreign key-dependent data is not supported. If the source database has such data, the task verification will report an error.

    Troubleshooting

    • MySQL/MariaDB/Percona/TDSQL-C/TDSQL for MySQL: Modify the foreign key parameter to a value type supported by DTS.
    • TDSQL for MySQL (TDStore Edition): Delete the foreign key parameter content.

    Modifying the foreign key rule

    When you set a foreign key in MySQL, there are four values that can be selected:

    • CASCADE: When a record is deleted or updated in the parent table, its associated records will also be deleted or updated in the child table.
    • SET NULL: When a record is deleted or updated in the parent table, the column of the foreign key field of its associated records will be set to null in the child table (child table foreign keys cannot be set to not null).
    • RESTRICT: When a record is deleted or updated in the parent table, if it is associated with records in the child table, the deletion request in the parent table will be denied.
    • NO ACTION: Similar to RESTRICT, the foreign key will be checked first.

    If an error occurs, fix it as follows:

    Windows

    1. Log in to the DMC platform in the source database as instructed in DMC Management.
    2. Select the table to be modified in the target tree on the left and click the Foreign Key tab on the opened table editing page to modify the foreign key parameter.
    3. After completing the modification, click Save.
    4. Run the verification task again.

    Linux

    1. Log in to the source database as instructed in Connecting to MySQL Instance.

    2. Delete the original foreign key settings.

      alter table `table name 1` drop foreign key `foreign key name 1`;
      
    3. Add the foreign key settings again.

      alter table `table name 1` add constraint `foreign key name 2` foreign key `table name 1`(`column name 1`) references `table name 2`(`column name 1`)
      on delete cascade on update cascade;
      
    4. Run the verification task again.

    Completing migration objects

    When modifying the migration task configuration, include objects with associations in Migration Object.

    1. Log in to the DTS console, select the target migration task, and click More > Modify in the Operation column.
    2. Select the objects with associations in Migration Object.
    3. Run the verification task again.
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support