Skip to content

Fix test suite to run against mysql 8.4 #2277

@MasterOdin

Description

@MasterOdin

From #2276, when running the test suite against mysql 8.4, saw the following test errors:

1) Test\Phinx\Db\Adapter\MysqlAdapterTest::testDropForeignKeyByNonExistentKeyColumns with data set #0 (array('ref_table_id'))
PDOException: SQLSTATE[HY000]: General error: 6125 Failed to add the foreign key constraint. Missing unique key for constraint 'table_ibfk_1' in the referenced table 'ref_table'

/home/runner/work/phinx/phinx/src/Phinx/Db/Adapter/PdoAdapter.php:202
/home/runner/work/phinx/phinx/src/Phinx/Db/Util/AlterInstructions.php:109
/home/runner/work/phinx/phinx/src/Phinx/Db/Adapter/PdoAdapter.php:692
/home/runner/work/phinx/phinx/src/Phinx/Db/Adapter/PdoAdapter.php:10[67](https://github.com/cakephp/phinx/actions/runs/9161376419/job/25186080392?pr=2276#step:14:68)
/home/runner/work/phinx/phinx/src/Phinx/Db/Plan/Plan.php:152
/home/runner/work/phinx/phinx/src/Phinx/Db/Table.php:722
/home/runner/work/phinx/phinx/src/Phinx/Db/Table.php:618
/home/runner/work/phinx/phinx/src/Phinx/Db/Table.php:[69](https://github.com/cakephp/phinx/actions/runs/9161376419/job/25186080392?pr=2276#step:14:70)1
/home/runner/work/phinx/phinx/tests/Phinx/Db/Adapter/MysqlAdapterTest.php:1810

2) Test\Phinx\Db\Adapter\MysqlAdapterTest::testDropForeignKeyByNonExistentKeyColumns with data set #1 (array('ref_table_field1'))
PDOException: SQLSTATE[HY000]: General error: 6125 Failed to add the foreign key constraint. Missing unique key for constraint 'table_ibfk_1' in the referenced table 'ref_table'

/home/runner/work/phinx/phinx/src/Phinx/Db/Adapter/PdoAdapter.php:202
/home/runner/work/phinx/phinx/src/Phinx/Db/Util/AlterInstructions.php:109
/home/runner/work/phinx/phinx/src/Phinx/Db/Adapter/PdoAdapter.php:692
/home/runner/work/phinx/phinx/src/Phinx/Db/Adapter/PdoAdapter.php:1067
/home/runner/work/phinx/phinx/src/Phinx/Db/Plan/Plan.php:152
/home/runner/work/phinx/phinx/src/Phinx/Db/Table.php:[72](https://github.com/cakephp/phinx/actions/runs/9161376419/job/25186080392?pr=2276#step:14:73)2
/home/runner/work/phinx/phinx/src/Phinx/Db/Table.php:618
/home/runner/work/phinx/phinx/src/Phinx/Db/Table.php:691
/home/runner/work/phinx/phinx/tests/Phinx/Db/Adapter/MysqlAdapterTest.php:1810

3) Test\Phinx\Db\Adapter\MysqlAdapterTest::testDropForeignKeyByNonExistentKeyColumns with data set #2 (array('ref_table_field1', 'ref_table_id'))
PDOException: SQLSTATE[HY000]: General error: 6125 Failed to add the foreign key constraint. Missing unique key for constraint 'table_ibfk_1' in the referenced table 'ref_table'

/home/runner/work/phinx/phinx/src/Phinx/Db/Adapter/PdoAdapter.php:202
/home/runner/work/phinx/phinx/src/Phinx/Db/Util/AlterInstructions.php:109
/home/runner/work/phinx/phinx/src/Phinx/Db/Adapter/PdoAdapter.php:692
/home/runner/work/phinx/phinx/src/Phinx/Db/Adapter/PdoAdapter.php:1067
/home/runner/work/phinx/phinx/src/Phinx/Db/Plan/Plan.php:152
/home/runner/work/phinx/phinx/src/Phinx/Db/Table.php:722
/home/runner/work/phinx/phinx/src/Phinx/Db/Table.php:618
/home/runner/work/phinx/phinx/src/Phinx/Db/Table.php:691
/home/runner/work/phinx/phinx/tests/Phinx/Db/Adapter/MysqlAdapterTest.php:1[81](https://github.com/cakephp/phinx/actions/runs/9161376419/job/25186080392?pr=2276#step:14:82)0

4) Test\Phinx\Db\Adapter\MysqlAdapterTest::testDropForeignKeyByNonExistentKeyColumns with data set #3 (array('non_existent_column'))
PDOException: SQLSTATE[HY000]: General error: 6125 Failed to add the foreign key constraint. Missing unique key for constraint 'table_ibfk_1' in the referenced table 'ref_table'

/home/runner/work/phinx/phinx/src/Phinx/Db/Adapter/PdoAdapter.php:202
/home/runner/work/phinx/phinx/src/Phinx/Db/Util/AlterInstructions.php:109
/home/runner/work/phinx/phinx/src/Phinx/Db/Adapter/PdoAdapter.php:692
/home/runner/work/phinx/phinx/src/Phinx/Db/Adapter/PdoAdapter.php:1067
/home/runner/work/phinx/phinx/src/Phinx/Db/Plan/Plan.php:152
/home/runner/work/phinx/phinx/src/Phinx/Db/Table.php:722
/home/runner/work/phinx/phinx/src/Phinx/Db/Table.php:618
/home/runner/work/phinx/phinx/src/Phinx/Db/Table.php:691
/home/runner/work/phinx/phinx/tests/Phinx/Db/Adapter/MysqlAdapterTest.php:1810

5) Test\Phinx\Db\Adapter\MysqlAdapterTest::testHasForeignKey with data set #3 ('create table t(a int, foreign...er(a))', 'a', true)
PDOException: SQLSTATE[HY000]: General error: 6125 Failed to add the foreign key constraint. Missing unique key for constraint 't_ibfk_1' in the referenced table 'other'

/home/runner/work/phinx/phinx/tests/Phinx/Db/Adapter/MysqlAdapterTest.php:1[88](https://github.com/cakephp/phinx/actions/runs/9161376419/job/25186080392?pr=2276#step:14:89)8

6) Test\Phinx\Db\Adapter\MysqlAdapterTest::testHasForeignKey with data set #4 ('create table t(a int, foreign...er(b))', 'a', true)
PDOException: SQLSTATE[HY000]: General error: 6125 Failed to add the foreign key constraint. Missing unique key for constraint 't_ibfk_1' in the referenced table 'other'

/home/runner/work/phinx/phinx/tests/Phinx/Db/Adapter/MysqlAdapterTest.php:1888

7) Test\Phinx\Db\Adapter\MysqlAdapterTest::testHasForeignKey with data set #5 ('create table t(a int, foreign...er(b))', array('a'), true)
PDOException: SQLSTATE[HY000]: General error: 6125 Failed to add the foreign key constraint. Missing unique key for constraint 't_ibfk_1' in the referenced table 'other'

/home/runner/work/phinx/phinx/tests/Phinx/Db/Adapter/MysqlAdapterTest.php:1888

8) Test\Phinx\Db\Adapter\MysqlAdapterTest::testHasForeignKey with data set #6 ('create table t(a int, foreign...er(b))', array('a', 'a'), false)
PDOException: SQLSTATE[HY000]: General error: 6125 Failed to add the foreign key constraint. Missing unique key for constraint 't_ibfk_1' in the referenced table 'other'

/home/runner/work/phinx/phinx/tests/Phinx/Db/Adapter/MysqlAdapterTest.php:1888

9) Test\Phinx\Db\Adapter\MysqlAdapterTest::testHasForeignKey with data set #7 ('create table t(a int, foreign...er(a))', 'a', true)
PDOException: SQLSTATE[HY000]: General error: 6125 Failed to add the foreign key constraint. Missing unique key for constraint 't_ibfk_1' in the referenced table 'other'

/home/runner/work/phinx/phinx/tests/Phinx/Db/Adapter/MysqlAdapterTest.php:1888

10) Test\Phinx\Db\Adapter\MysqlAdapterTest::testHasForeignKey with data set #8 ('create table t(a int, b int, ...(a,b))', 'a', false)
PDOException: SQLSTATE[HY000]: General error: 6125 Failed to add the foreign key constraint. Missing unique key for constraint 't_ibfk_1' in the referenced table 'other'

/home/runner/work/phinx/phinx/tests/Phinx/Db/Adapter/MysqlAdapterTest.php:1888

11) Test\Phinx\Db\Adapter\MysqlAdapterTest::testHasForeignKey with data set #9 ('create table t(a int, b int, ...(a,b))', array('a', 'b'), true)
PDOException: SQLSTATE[HY000]: General error: 6125 Failed to add the foreign key constraint. Missing unique key for constraint 't_ibfk_1' in the referenced table 'other'

/home/runner/work/phinx/phinx/tests/Phinx/Db/Adapter/MysqlAdapterTest.php:1888

12) Test\Phinx\Db\Adapter\MysqlAdapterTest::testHasForeignKey with data set #10 ('create table t(a int, b int, ...(a,b))', array('b', 'a'), false)
PDOException: SQLSTATE[HY000]: General error: 6125 Failed to add the foreign key constraint. Missing unique key for constraint 't_ibfk_1' in the referenced table 'other'

/home/runner/work/phinx/phinx/tests/Phinx/Db/Adapter/MysqlAdapterTest.php:1888

13) Test\Phinx\Db\Adapter\MysqlAdapterTest::testHasForeignKey with data set #11 ('create table t(a int, `B` int...(a,b))', array('a', 'b'), true)
PDOException: SQLSTATE[HY000]: General error: 6[125](https://github.com/cakephp/phinx/actions/runs/9161376419/job/25186080392?pr=2276#step:14:126) Failed to add the foreign key constraint. Missing unique key for constraint 't_ibfk_1' in the referenced table 'other'

/home/runner/work/phinx/phinx/tests/Phinx/Db/Adapter/MysqlAdapterTest.php:1888

14) Test\Phinx\Db\Adapter\MysqlAdapterTest::testHasForeignKey with data set #12 ('create table t(a int, b int, ...(a,b))', array('a', 'B'), true)
PDOException: SQLSTATE[HY000]: General error: 6125 Failed to add the foreign key constraint. Missing unique key for constraint 't_ibfk_1' in the referenced table 'other'

/home/runner/work/phinx/phinx/tests/Phinx/Db/Adapter/MysqlAdapterTest.php:1888

15) Test\Phinx\Db\Adapter\MysqlAdapterTest::testHasForeignKey with data set #13 ('create table t(a int, b int, ...,b,c))', array('a', 'b'), false)
PDOException: SQLSTATE[HY000]: General error: 6125 Failed to add the foreign key constraint. Missing unique key for constraint 't_ibfk_1' in the referenced table 'other'

/home/runner/work/phinx/phinx/tests/Phinx/Db/Adapter/MysqlAdapterTest.php:1888

16) Test\Phinx\Db\Adapter\MysqlAdapterTest::testHasForeignKey with data set #14 ('create table t(a int, foreign...er(a))', array('a', 'b'), false)
PDOException: SQLSTATE[HY000]: General error: 6125 Failed to add the foreign key constraint. Missing unique key for constraint 't_ibfk_1' in the referenced table 'other'

/home/runner/work/phinx/phinx/tests/Phinx/Db/Adapter/MysqlAdapterTest.php:1888

17) Test\Phinx\Db\Adapter\MysqlAdapterTest::testHasForeignKey with data set #15 ('create table t(a int, b int, ...er(b))', array('a', 'b'), false)
PDOException: SQLSTATE[HY000]: General error: 6125 Failed to add the foreign key constraint. Missing unique key for constraint 't_ibfk_1' in the referenced table 'other'

/home/runner/work/phinx/phinx/tests/Phinx/Db/Adapter/MysqlAdapterTest.php:1888

18) Test\Phinx\Db\Adapter\MysqlAdapterTest::testHasForeignKey with data set #16 ('create table t(a int, b int, ...er(b))', array('a', 'b'), false)
PDOException: SQLSTATE[HY000]: General error: 6125 Failed to add the foreign key constraint. Missing unique key for constraint 't_ibfk_1' in the referenced table 'other'

/home/runner/work/phinx/phinx/tests/Phinx/Db/Adapter/MysqlAdapterTest.php:1888

19) Test\Phinx\Db\Adapter\MysqlAdapterTest::testHasForeignKey with data set #17 ('create table t(`0` int, forei...er(a))', '0', true)
PDOException: SQLSTATE[HY000]: General error: 6125 Failed to add the foreign key constraint. Missing unique key for constraint 't_ibfk_1' in the referenced table 'other'

/home/runner/work/phinx/phinx/tests/Phinx/Db/Adapter/MysqlAdapterTest.php:1888

20) Test\Phinx\Db\Adapter\MysqlAdapterTest::testHasForeignKey with data set #18 ('create table t(`0` int, forei...er(a))', '0e0', false)
PDOException: SQLSTATE[HY000]: General error: 6125 Failed to add the foreign key constraint. Missing unique key for constraint 't_ibfk_1' in the referenced table 'other'

/home/runner/work/phinx/phinx/tests/Phinx/Db/Adapter/MysqlAdapterTest.php:1888

21) Test\Phinx\Db\Adapter\MysqlAdapterTest::testHasForeignKey with data set #19 ('create table t(`0e0` int, for...er(a))', '0', false)
PDOException: SQLSTATE[HY000]: General error: 6125 Failed to add the foreign key constraint. Missing unique key for constraint 't_ibfk_1' in the referenced table 'other'

/home/runner/work/phinx/phinx/tests/Phinx/Db/Adapter/MysqlAdapterTest.php:1888

Need to investigate and potentially have a fix for whatever changed in mysql.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions