diff --git a/src/Db/Table/ForeignKey.php b/src/Db/Table/ForeignKey.php index 907e5f37..3e4a4d39 100644 --- a/src/Db/Table/ForeignKey.php +++ b/src/Db/Table/ForeignKey.php @@ -100,11 +100,11 @@ public function setOptions(array $options) throw new RuntimeException(sprintf('"%s" is not a valid foreign key option.', $option)); } - // handle $options['delete'] as $options['update'] + // handle $options['delete'] and $options['update'] if ($option === 'delete') { - $this->setOnDelete($value); + $this->delete = $this->normalizeAction($value); } elseif ($option === 'update') { - $this->setOnUpdate($value); + $this->update = $this->normalizeAction($value); } elseif ($option === 'deferrable') { $this->setDeferrableMode($value); } else { diff --git a/templates/bake/element/add-foreign-keys.twig b/templates/bake/element/add-foreign-keys.twig index 774cf80d..9f67c0e5 100644 --- a/templates/bake/element/add-foreign-keys.twig +++ b/templates/bake/element/add-foreign-keys.twig @@ -28,8 +28,8 @@ $this->foreignKey({{ columnsList | raw }}) ->setReferencedTable('{{ constraint['references'][0] }}') ->setReferencedColumns({{ columnsReference | raw }}) - ->setOnDelete('{{ Migration.formatConstraintAction(constraint['delete']) | raw }}') - ->setOnUpdate('{{ Migration.formatConstraintAction(constraint['update']) | raw }}') + ->setDelete('{{ Migration.formatConstraintAction(constraint['delete']) | raw }}') + ->setUpdate('{{ Migration.formatConstraintAction(constraint['update']) | raw }}') ->setName('{{ constraintName }}') ) {%~ endif %} diff --git a/templates/bake/element/change-method-body.twig b/templates/bake/element/change-method-body.twig index e1370cd4..e36e7fb4 100644 --- a/templates/bake/element/change-method-body.twig +++ b/templates/bake/element/change-method-body.twig @@ -59,8 +59,8 @@ $this->foreignKey({{ columnsList | raw }}) ->setReferencedTable('{{ constraint['references'][0] }}') ->setReferencedColumns({{ columnsReference | raw }}) - ->setOnDelete('{{ Migration.formatConstraintAction(constraint['delete']) | raw }}') - ->setOnUpdate('{{ Migration.formatConstraintAction(constraint['update']) | raw }}') + ->setDelete('{{ Migration.formatConstraintAction(constraint['delete']) | raw }}') + ->setUpdate('{{ Migration.formatConstraintAction(constraint['update']) | raw }}') ->setName('{{ constraintName }}') ); {%~ endif %} diff --git a/tests/TestCase/Db/Table/TableTest.php b/tests/TestCase/Db/Table/TableTest.php index 21912fd5..463e9aa8 100644 --- a/tests/TestCase/Db/Table/TableTest.php +++ b/tests/TestCase/Db/Table/TableTest.php @@ -144,8 +144,7 @@ public function testAddForeignKeyWithObject(): void $key->setColumns('user_id') ->setReferencedTable('users') ->setReferencedColumns(['id']) - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setOptions(['delete' => 'CASCADE', 'update' => 'CASCADE']) ->setName('fk_user_id'), ); diff --git a/tests/comparisons/Diff/default/the_diff_default_mysql.php b/tests/comparisons/Diff/default/the_diff_default_mysql.php index a889d9e7..4dce76e4 100644 --- a/tests/comparisons/Diff/default/the_diff_default_mysql.php +++ b/tests/comparisons/Diff/default/the_diff_default_mysql.php @@ -99,8 +99,8 @@ public function up(): void $this->foreignKey('user_id') ->setReferencedTable('users') ->setReferencedColumns('id') - ->setOnDelete('RESTRICT') - ->setOnUpdate('RESTRICT') + ->setDelete('RESTRICT') + ->setUpdate('RESTRICT') ->setName('categories_ibfk_1') ) ->update(); @@ -232,8 +232,8 @@ public function down(): void $this->foreignKey('user_id') ->setReferencedTable('users') ->setReferencedColumns('id') - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ->setName('articles_ibfk_1') ) ->update(); diff --git a/tests/comparisons/Diff/default/the_diff_default_pgsql.php b/tests/comparisons/Diff/default/the_diff_default_pgsql.php index 54b61d85..52e1f076 100644 --- a/tests/comparisons/Diff/default/the_diff_default_pgsql.php +++ b/tests/comparisons/Diff/default/the_diff_default_pgsql.php @@ -64,8 +64,8 @@ public function up(): void $this->foreignKey('user_id') ->setReferencedTable('users') ->setReferencedColumns('id') - ->setOnDelete('RESTRICT') - ->setOnUpdate('RESTRICT') + ->setDelete('RESTRICT') + ->setUpdate('RESTRICT') ) ->update(); @@ -114,8 +114,8 @@ public function up(): void $this->foreignKey('category_id') ->setReferencedTable('categories') ->setReferencedColumns('id') - ->setOnDelete('NO_ACTION') - ->setOnUpdate('NO_ACTION') + ->setDelete('NO_ACTION') + ->setUpdate('NO_ACTION') ) ->update(); @@ -207,8 +207,8 @@ public function down(): void $this->foreignKey('user_id') ->setReferencedTable('users') ->setReferencedColumns('id') - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ) ->update(); diff --git a/tests/comparisons/Diff/simple/the_diff_simple_mysql.php b/tests/comparisons/Diff/simple/the_diff_simple_mysql.php index 93edeb6d..65565a19 100644 --- a/tests/comparisons/Diff/simple/the_diff_simple_mysql.php +++ b/tests/comparisons/Diff/simple/the_diff_simple_mysql.php @@ -70,8 +70,8 @@ public function up(): void $this->foreignKey('user_id') ->setReferencedTable('users') ->setReferencedColumns('id') - ->setOnDelete('RESTRICT') - ->setOnUpdate('RESTRICT') + ->setDelete('RESTRICT') + ->setUpdate('RESTRICT') ->setName('articles_ibfk_1') ) ->update(); diff --git a/tests/comparisons/Migration/pgsql/test_snapshot_auto_id_disabled_pgsql.php b/tests/comparisons/Migration/pgsql/test_snapshot_auto_id_disabled_pgsql.php index eca100cc..bbe49420 100644 --- a/tests/comparisons/Migration/pgsql/test_snapshot_auto_id_disabled_pgsql.php +++ b/tests/comparisons/Migration/pgsql/test_snapshot_auto_id_disabled_pgsql.php @@ -370,8 +370,8 @@ public function up(): void $this->foreignKey('category_id') ->setReferencedTable('categories') ->setReferencedColumns('id') - ->setOnDelete('NO_ACTION') - ->setOnUpdate('NO_ACTION') + ->setDelete('NO_ACTION') + ->setUpdate('NO_ACTION') ->setName('articles_category_fk') ) ->update(); @@ -387,8 +387,8 @@ public function up(): void 'category_id', 'id', ]) - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ->setName('orders_product_fk') ) ->update(); @@ -398,8 +398,8 @@ public function up(): void $this->foreignKey('category_id') ->setReferencedTable('categories') ->setReferencedColumns('id') - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ->setName('products_category_fk') ) ->update(); diff --git a/tests/comparisons/Migration/pgsql/test_snapshot_not_empty_pgsql.php b/tests/comparisons/Migration/pgsql/test_snapshot_not_empty_pgsql.php index e297c18c..8ff44ed6 100644 --- a/tests/comparisons/Migration/pgsql/test_snapshot_not_empty_pgsql.php +++ b/tests/comparisons/Migration/pgsql/test_snapshot_not_empty_pgsql.php @@ -310,8 +310,8 @@ public function up(): void $this->foreignKey('category_id') ->setReferencedTable('categories') ->setReferencedColumns('id') - ->setOnDelete('NO_ACTION') - ->setOnUpdate('NO_ACTION') + ->setDelete('NO_ACTION') + ->setUpdate('NO_ACTION') ->setName('articles_category_fk') ) ->update(); @@ -327,8 +327,8 @@ public function up(): void 'category_id', 'id', ]) - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ->setName('orders_product_fk') ) ->update(); @@ -338,8 +338,8 @@ public function up(): void $this->foreignKey('category_id') ->setReferencedTable('categories') ->setReferencedColumns('id') - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ->setName('products_category_fk') ) ->update(); diff --git a/tests/comparisons/Migration/pgsql/test_snapshot_plugin_blog_pgsql.php b/tests/comparisons/Migration/pgsql/test_snapshot_plugin_blog_pgsql.php index 2541ce03..25f27019 100644 --- a/tests/comparisons/Migration/pgsql/test_snapshot_plugin_blog_pgsql.php +++ b/tests/comparisons/Migration/pgsql/test_snapshot_plugin_blog_pgsql.php @@ -310,8 +310,8 @@ public function up(): void $this->foreignKey('category_id') ->setReferencedTable('categories') ->setReferencedColumns('id') - ->setOnDelete('NO_ACTION') - ->setOnUpdate('NO_ACTION') + ->setDelete('NO_ACTION') + ->setUpdate('NO_ACTION') ->setName('articles_category_fk') ) ->update(); @@ -327,8 +327,8 @@ public function up(): void 'category_id', 'id', ]) - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ->setName('orders_product_fk') ) ->update(); @@ -338,8 +338,8 @@ public function up(): void $this->foreignKey('category_id') ->setReferencedTable('categories') ->setReferencedColumns('id') - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ->setName('products_category_fk') ) ->update(); diff --git a/tests/comparisons/Migration/pgsql/test_snapshot_with_change_pgsql.php b/tests/comparisons/Migration/pgsql/test_snapshot_with_change_pgsql.php index 1191bd8c..2c3cb4f5 100644 --- a/tests/comparisons/Migration/pgsql/test_snapshot_with_change_pgsql.php +++ b/tests/comparisons/Migration/pgsql/test_snapshot_with_change_pgsql.php @@ -310,8 +310,8 @@ public function change(): void $this->foreignKey('category_id') ->setReferencedTable('categories') ->setReferencedColumns('id') - ->setOnDelete('NO_ACTION') - ->setOnUpdate('NO_ACTION') + ->setDelete('NO_ACTION') + ->setUpdate('NO_ACTION') ->setName('articles_category_fk') ) ->update(); @@ -327,8 +327,8 @@ public function change(): void 'category_id', 'id', ]) - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ->setName('orders_product_fk') ) ->update(); @@ -338,8 +338,8 @@ public function change(): void $this->foreignKey('category_id') ->setReferencedTable('categories') ->setReferencedColumns('id') - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ->setName('products_category_fk') ) ->update(); diff --git a/tests/comparisons/Migration/sqlite/test_snapshot_auto_id_disabled_sqlite.php b/tests/comparisons/Migration/sqlite/test_snapshot_auto_id_disabled_sqlite.php index 24da5e35..12261cdd 100644 --- a/tests/comparisons/Migration/sqlite/test_snapshot_auto_id_disabled_sqlite.php +++ b/tests/comparisons/Migration/sqlite/test_snapshot_auto_id_disabled_sqlite.php @@ -351,8 +351,8 @@ public function up(): void $this->foreignKey('category_id') ->setReferencedTable('categories') ->setReferencedColumns('id') - ->setOnDelete('NO_ACTION') - ->setOnUpdate('NO_ACTION') + ->setDelete('NO_ACTION') + ->setUpdate('NO_ACTION') ->setName('articles_category_fk') ) ->update(); @@ -368,8 +368,8 @@ public function up(): void 'category_id', 'id', ]) - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ->setName('orders_product_fk') ) ->update(); @@ -379,8 +379,8 @@ public function up(): void $this->foreignKey('category_id') ->setReferencedTable('categories') ->setReferencedColumns('id') - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ->setName('products_category_fk') ) ->update(); diff --git a/tests/comparisons/Migration/sqlite/test_snapshot_not_empty_sqlite.php b/tests/comparisons/Migration/sqlite/test_snapshot_not_empty_sqlite.php index e292c18e..bef6d8ce 100644 --- a/tests/comparisons/Migration/sqlite/test_snapshot_not_empty_sqlite.php +++ b/tests/comparisons/Migration/sqlite/test_snapshot_not_empty_sqlite.php @@ -291,8 +291,8 @@ public function up(): void $this->foreignKey('category_id') ->setReferencedTable('categories') ->setReferencedColumns('id') - ->setOnDelete('NO_ACTION') - ->setOnUpdate('NO_ACTION') + ->setDelete('NO_ACTION') + ->setUpdate('NO_ACTION') ->setName('articles_category_fk') ) ->update(); @@ -308,8 +308,8 @@ public function up(): void 'category_id', 'id', ]) - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ->setName('orders_product_fk') ) ->update(); @@ -319,8 +319,8 @@ public function up(): void $this->foreignKey('category_id') ->setReferencedTable('categories') ->setReferencedColumns('id') - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ->setName('products_category_fk') ) ->update(); diff --git a/tests/comparisons/Migration/sqlite/test_snapshot_plugin_blog_sqlite.php b/tests/comparisons/Migration/sqlite/test_snapshot_plugin_blog_sqlite.php index 78ae984e..f9f84028 100644 --- a/tests/comparisons/Migration/sqlite/test_snapshot_plugin_blog_sqlite.php +++ b/tests/comparisons/Migration/sqlite/test_snapshot_plugin_blog_sqlite.php @@ -291,8 +291,8 @@ public function up(): void $this->foreignKey('category_id') ->setReferencedTable('categories') ->setReferencedColumns('id') - ->setOnDelete('NO_ACTION') - ->setOnUpdate('NO_ACTION') + ->setDelete('NO_ACTION') + ->setUpdate('NO_ACTION') ->setName('articles_category_fk') ) ->update(); @@ -308,8 +308,8 @@ public function up(): void 'category_id', 'id', ]) - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ->setName('orders_product_fk') ) ->update(); @@ -319,8 +319,8 @@ public function up(): void $this->foreignKey('category_id') ->setReferencedTable('categories') ->setReferencedColumns('id') - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ->setName('products_category_fk') ) ->update(); diff --git a/tests/comparisons/Migration/sqlite/test_snapshot_with_change_sqlite.php b/tests/comparisons/Migration/sqlite/test_snapshot_with_change_sqlite.php index f1fbd6ee..857bbde1 100644 --- a/tests/comparisons/Migration/sqlite/test_snapshot_with_change_sqlite.php +++ b/tests/comparisons/Migration/sqlite/test_snapshot_with_change_sqlite.php @@ -291,8 +291,8 @@ public function change(): void $this->foreignKey('category_id') ->setReferencedTable('categories') ->setReferencedColumns('id') - ->setOnDelete('NO_ACTION') - ->setOnUpdate('NO_ACTION') + ->setDelete('NO_ACTION') + ->setUpdate('NO_ACTION') ->setName('articles_category_fk') ) ->update(); @@ -308,8 +308,8 @@ public function change(): void 'category_id', 'id', ]) - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ->setName('orders_product_fk') ) ->update(); @@ -319,8 +319,8 @@ public function change(): void $this->foreignKey('category_id') ->setReferencedTable('categories') ->setReferencedColumns('id') - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ->setName('products_category_fk') ) ->update(); diff --git a/tests/comparisons/Migration/sqlserver/test_snapshot_auto_id_disabled_sqlserver.php b/tests/comparisons/Migration/sqlserver/test_snapshot_auto_id_disabled_sqlserver.php index 347b5cdd..47b630bf 100644 --- a/tests/comparisons/Migration/sqlserver/test_snapshot_auto_id_disabled_sqlserver.php +++ b/tests/comparisons/Migration/sqlserver/test_snapshot_auto_id_disabled_sqlserver.php @@ -386,8 +386,8 @@ public function up(): void $this->foreignKey('category_id') ->setReferencedTable('categories') ->setReferencedColumns('id') - ->setOnDelete('NO_ACTION') - ->setOnUpdate('NO_ACTION') + ->setDelete('NO_ACTION') + ->setUpdate('NO_ACTION') ->setName('articles_category_fk') ) ->update(); @@ -403,8 +403,8 @@ public function up(): void 'category_id', 'id', ]) - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ->setName('orders_product_fk') ) ->update(); @@ -414,8 +414,8 @@ public function up(): void $this->foreignKey('category_id') ->setReferencedTable('categories') ->setReferencedColumns('id') - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ->setName('products_category_fk') ) ->update(); diff --git a/tests/comparisons/Migration/sqlserver/test_snapshot_not_empty_sqlserver.php b/tests/comparisons/Migration/sqlserver/test_snapshot_not_empty_sqlserver.php index e0aad74e..aa2bc9a3 100644 --- a/tests/comparisons/Migration/sqlserver/test_snapshot_not_empty_sqlserver.php +++ b/tests/comparisons/Migration/sqlserver/test_snapshot_not_empty_sqlserver.php @@ -326,8 +326,8 @@ public function up(): void $this->foreignKey('category_id') ->setReferencedTable('categories') ->setReferencedColumns('id') - ->setOnDelete('NO_ACTION') - ->setOnUpdate('NO_ACTION') + ->setDelete('NO_ACTION') + ->setUpdate('NO_ACTION') ->setName('articles_category_fk') ) ->update(); @@ -343,8 +343,8 @@ public function up(): void 'category_id', 'id', ]) - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ->setName('orders_product_fk') ) ->update(); @@ -354,8 +354,8 @@ public function up(): void $this->foreignKey('category_id') ->setReferencedTable('categories') ->setReferencedColumns('id') - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ->setName('products_category_fk') ) ->update(); diff --git a/tests/comparisons/Migration/sqlserver/test_snapshot_plugin_blog_sqlserver.php b/tests/comparisons/Migration/sqlserver/test_snapshot_plugin_blog_sqlserver.php index c8d0e8db..8e49310d 100644 --- a/tests/comparisons/Migration/sqlserver/test_snapshot_plugin_blog_sqlserver.php +++ b/tests/comparisons/Migration/sqlserver/test_snapshot_plugin_blog_sqlserver.php @@ -326,8 +326,8 @@ public function up(): void $this->foreignKey('category_id') ->setReferencedTable('categories') ->setReferencedColumns('id') - ->setOnDelete('NO_ACTION') - ->setOnUpdate('NO_ACTION') + ->setDelete('NO_ACTION') + ->setUpdate('NO_ACTION') ->setName('articles_category_fk') ) ->update(); @@ -343,8 +343,8 @@ public function up(): void 'category_id', 'id', ]) - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ->setName('orders_product_fk') ) ->update(); @@ -354,8 +354,8 @@ public function up(): void $this->foreignKey('category_id') ->setReferencedTable('categories') ->setReferencedColumns('id') - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ->setName('products_category_fk') ) ->update(); diff --git a/tests/comparisons/Migration/sqlserver/test_snapshot_with_change_sqlserver.php b/tests/comparisons/Migration/sqlserver/test_snapshot_with_change_sqlserver.php index 36ef3a9b..f1282faf 100644 --- a/tests/comparisons/Migration/sqlserver/test_snapshot_with_change_sqlserver.php +++ b/tests/comparisons/Migration/sqlserver/test_snapshot_with_change_sqlserver.php @@ -326,8 +326,8 @@ public function change(): void $this->foreignKey('category_id') ->setReferencedTable('categories') ->setReferencedColumns('id') - ->setOnDelete('NO_ACTION') - ->setOnUpdate('NO_ACTION') + ->setDelete('NO_ACTION') + ->setUpdate('NO_ACTION') ->setName('articles_category_fk') ) ->update(); @@ -343,8 +343,8 @@ public function change(): void 'category_id', 'id', ]) - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ->setName('orders_product_fk') ) ->update(); @@ -354,8 +354,8 @@ public function change(): void $this->foreignKey('category_id') ->setReferencedTable('categories') ->setReferencedColumns('id') - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ->setName('products_category_fk') ) ->update(); diff --git a/tests/comparisons/Migration/testAddFieldWithReference.php b/tests/comparisons/Migration/testAddFieldWithReference.php index b50ad2f9..b6c5ccfb 100644 --- a/tests/comparisons/Migration/testAddFieldWithReference.php +++ b/tests/comparisons/Migration/testAddFieldWithReference.php @@ -25,8 +25,8 @@ public function change(): void $this->foreignKey('category_id') ->setReferencedTable('categories') ->setReferencedColumns('id') - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ->setName('fk_category_id') ); $table->update(); diff --git a/tests/comparisons/Migration/testCreateWithReferences.php b/tests/comparisons/Migration/testCreateWithReferences.php index 11c01ca2..5537e448 100644 --- a/tests/comparisons/Migration/testCreateWithReferences.php +++ b/tests/comparisons/Migration/testCreateWithReferences.php @@ -30,8 +30,8 @@ public function change(): void $this->foreignKey('user_id') ->setReferencedTable('users') ->setReferencedColumns('id') - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ->setName('fk_user_id') ); $table->create(); diff --git a/tests/comparisons/Migration/testCreateWithReferencesCustomTable.php b/tests/comparisons/Migration/testCreateWithReferencesCustomTable.php index a4829f3c..6897dd2a 100644 --- a/tests/comparisons/Migration/testCreateWithReferencesCustomTable.php +++ b/tests/comparisons/Migration/testCreateWithReferencesCustomTable.php @@ -30,8 +30,8 @@ public function change(): void $this->foreignKey('author_id') ->setReferencedTable('authors') ->setReferencedColumns('id') - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ->setName('fk_author_id') ); $table->create(); diff --git a/tests/comparisons/Migration/test_snapshot_auto_id_disabled.php b/tests/comparisons/Migration/test_snapshot_auto_id_disabled.php index 9024c29a..c8d07b21 100644 --- a/tests/comparisons/Migration/test_snapshot_auto_id_disabled.php +++ b/tests/comparisons/Migration/test_snapshot_auto_id_disabled.php @@ -376,8 +376,8 @@ public function up(): void $this->foreignKey('category_id') ->setReferencedTable('categories') ->setReferencedColumns('id') - ->setOnDelete('NO_ACTION') - ->setOnUpdate('NO_ACTION') + ->setDelete('NO_ACTION') + ->setUpdate('NO_ACTION') ->setName('articles_category_fk') ) ->update(); @@ -393,8 +393,8 @@ public function up(): void 'category_id', 'id', ]) - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ->setName('orders_product_fk') ) ->update(); @@ -404,8 +404,8 @@ public function up(): void $this->foreignKey('category_id') ->setReferencedTable('categories') ->setReferencedColumns('id') - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ->setName('products_category_fk') ) ->update(); diff --git a/tests/comparisons/Migration/test_snapshot_not_empty.php b/tests/comparisons/Migration/test_snapshot_not_empty.php index 1a277d71..4bde415d 100644 --- a/tests/comparisons/Migration/test_snapshot_not_empty.php +++ b/tests/comparisons/Migration/test_snapshot_not_empty.php @@ -308,8 +308,8 @@ public function up(): void $this->foreignKey('category_id') ->setReferencedTable('categories') ->setReferencedColumns('id') - ->setOnDelete('NO_ACTION') - ->setOnUpdate('NO_ACTION') + ->setDelete('NO_ACTION') + ->setUpdate('NO_ACTION') ->setName('articles_category_fk') ) ->update(); @@ -325,8 +325,8 @@ public function up(): void 'category_id', 'id', ]) - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ->setName('orders_product_fk') ) ->update(); @@ -336,8 +336,8 @@ public function up(): void $this->foreignKey('category_id') ->setReferencedTable('categories') ->setReferencedColumns('id') - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ->setName('products_category_fk') ) ->update(); diff --git a/tests/comparisons/Migration/test_snapshot_plugin_blog.php b/tests/comparisons/Migration/test_snapshot_plugin_blog.php index 20dd3fba..d3367359 100644 --- a/tests/comparisons/Migration/test_snapshot_plugin_blog.php +++ b/tests/comparisons/Migration/test_snapshot_plugin_blog.php @@ -308,8 +308,8 @@ public function up(): void $this->foreignKey('category_id') ->setReferencedTable('categories') ->setReferencedColumns('id') - ->setOnDelete('NO_ACTION') - ->setOnUpdate('NO_ACTION') + ->setDelete('NO_ACTION') + ->setUpdate('NO_ACTION') ->setName('articles_category_fk') ) ->update(); @@ -325,8 +325,8 @@ public function up(): void 'category_id', 'id', ]) - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ->setName('orders_product_fk') ) ->update(); @@ -336,8 +336,8 @@ public function up(): void $this->foreignKey('category_id') ->setReferencedTable('categories') ->setReferencedColumns('id') - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ->setName('products_category_fk') ) ->update(); diff --git a/tests/comparisons/Migration/test_snapshot_postgres_timestamp_tz_pgsql.php b/tests/comparisons/Migration/test_snapshot_postgres_timestamp_tz_pgsql.php index 51b0002a..e4f7da4f 100644 --- a/tests/comparisons/Migration/test_snapshot_postgres_timestamp_tz_pgsql.php +++ b/tests/comparisons/Migration/test_snapshot_postgres_timestamp_tz_pgsql.php @@ -320,8 +320,8 @@ public function up(): void $this->foreignKey('category_id') ->setReferencedTable('categories') ->setReferencedColumns('id') - ->setOnDelete('NO_ACTION') - ->setOnUpdate('NO_ACTION') + ->setDelete('NO_ACTION') + ->setUpdate('NO_ACTION') ->setName('articles_category_fk') ) ->update(); @@ -337,8 +337,8 @@ public function up(): void 'category_id', 'id', ]) - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ->setName('orders_product_fk') ) ->update(); @@ -348,8 +348,8 @@ public function up(): void $this->foreignKey('category_id') ->setReferencedTable('categories') ->setReferencedColumns('id') - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ->setName('products_category_fk') ) ->update(); diff --git a/tests/comparisons/Migration/test_snapshot_with_auto_id_compatible_signed_primary_keys.php b/tests/comparisons/Migration/test_snapshot_with_auto_id_compatible_signed_primary_keys.php index df2ea8ba..3da752b2 100644 --- a/tests/comparisons/Migration/test_snapshot_with_auto_id_compatible_signed_primary_keys.php +++ b/tests/comparisons/Migration/test_snapshot_with_auto_id_compatible_signed_primary_keys.php @@ -375,8 +375,8 @@ public function up(): void $this->foreignKey('category_id') ->setReferencedTable('categories') ->setReferencedColumns('id') - ->setOnDelete('NO_ACTION') - ->setOnUpdate('NO_ACTION') + ->setDelete('NO_ACTION') + ->setUpdate('NO_ACTION') ->setName('articles_category_fk') ) ->update(); @@ -392,8 +392,8 @@ public function up(): void 'category_id', 'id', ]) - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ->setName('orders_product_fk') ) ->update(); @@ -403,8 +403,8 @@ public function up(): void $this->foreignKey('category_id') ->setReferencedTable('categories') ->setReferencedColumns('id') - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ->setName('products_category_fk') ) ->update(); diff --git a/tests/comparisons/Migration/test_snapshot_with_auto_id_incompatible_signed_primary_keys.php b/tests/comparisons/Migration/test_snapshot_with_auto_id_incompatible_signed_primary_keys.php index 11fadb44..13f8327d 100644 --- a/tests/comparisons/Migration/test_snapshot_with_auto_id_incompatible_signed_primary_keys.php +++ b/tests/comparisons/Migration/test_snapshot_with_auto_id_incompatible_signed_primary_keys.php @@ -375,8 +375,8 @@ public function up(): void $this->foreignKey('category_id') ->setReferencedTable('categories') ->setReferencedColumns('id') - ->setOnDelete('NO_ACTION') - ->setOnUpdate('NO_ACTION') + ->setDelete('NO_ACTION') + ->setUpdate('NO_ACTION') ->setName('articles_category_fk') ) ->update(); @@ -392,8 +392,8 @@ public function up(): void 'category_id', 'id', ]) - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ->setName('orders_product_fk') ) ->update(); @@ -403,8 +403,8 @@ public function up(): void $this->foreignKey('category_id') ->setReferencedTable('categories') ->setReferencedColumns('id') - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ->setName('products_category_fk') ) ->update(); diff --git a/tests/comparisons/Migration/test_snapshot_with_auto_id_incompatible_unsigned_primary_keys.php b/tests/comparisons/Migration/test_snapshot_with_auto_id_incompatible_unsigned_primary_keys.php index 93570e1e..bdf09994 100644 --- a/tests/comparisons/Migration/test_snapshot_with_auto_id_incompatible_unsigned_primary_keys.php +++ b/tests/comparisons/Migration/test_snapshot_with_auto_id_incompatible_unsigned_primary_keys.php @@ -376,8 +376,8 @@ public function up(): void $this->foreignKey('category_id') ->setReferencedTable('categories') ->setReferencedColumns('id') - ->setOnDelete('NO_ACTION') - ->setOnUpdate('NO_ACTION') + ->setDelete('NO_ACTION') + ->setUpdate('NO_ACTION') ->setName('articles_category_fk') ) ->update(); @@ -393,8 +393,8 @@ public function up(): void 'category_id', 'id', ]) - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ->setName('orders_product_fk') ) ->update(); @@ -404,8 +404,8 @@ public function up(): void $this->foreignKey('category_id') ->setReferencedTable('categories') ->setReferencedColumns('id') - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ->setName('products_category_fk') ) ->update(); diff --git a/tests/comparisons/Migration/test_snapshot_with_change.php b/tests/comparisons/Migration/test_snapshot_with_change.php index ec5f12a6..d4a43233 100644 --- a/tests/comparisons/Migration/test_snapshot_with_change.php +++ b/tests/comparisons/Migration/test_snapshot_with_change.php @@ -308,8 +308,8 @@ public function change(): void $this->foreignKey('category_id') ->setReferencedTable('categories') ->setReferencedColumns('id') - ->setOnDelete('NO_ACTION') - ->setOnUpdate('NO_ACTION') + ->setDelete('NO_ACTION') + ->setUpdate('NO_ACTION') ->setName('articles_category_fk') ) ->update(); @@ -325,8 +325,8 @@ public function change(): void 'category_id', 'id', ]) - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ->setName('orders_product_fk') ) ->update(); @@ -336,8 +336,8 @@ public function change(): void $this->foreignKey('category_id') ->setReferencedTable('categories') ->setReferencedColumns('id') - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ->setName('products_category_fk') ) ->update(); diff --git a/tests/comparisons/Migration/test_snapshot_with_non_default_collation.php b/tests/comparisons/Migration/test_snapshot_with_non_default_collation.php index 45cad82a..c48d00a4 100644 --- a/tests/comparisons/Migration/test_snapshot_with_non_default_collation.php +++ b/tests/comparisons/Migration/test_snapshot_with_non_default_collation.php @@ -309,8 +309,8 @@ public function up(): void $this->foreignKey('category_id') ->setReferencedTable('categories') ->setReferencedColumns('id') - ->setOnDelete('NO_ACTION') - ->setOnUpdate('NO_ACTION') + ->setDelete('NO_ACTION') + ->setUpdate('NO_ACTION') ->setName('articles_category_fk') ) ->update(); @@ -326,8 +326,8 @@ public function up(): void 'category_id', 'id', ]) - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ->setName('orders_product_fk') ) ->update(); @@ -337,8 +337,8 @@ public function up(): void $this->foreignKey('category_id') ->setReferencedTable('categories') ->setReferencedColumns('id') - ->setOnDelete('CASCADE') - ->setOnUpdate('CASCADE') + ->setDelete('CASCADE') + ->setUpdate('CASCADE') ->setName('products_category_fk') ) ->update();