class Migration1688717599UpdateCreatedByIdAndUpdatedByIdInOrderAndCustomerTest extends TestCase
{ public function testUpdateRuleAssociationsToRestrict(): void
{ $conn = KernelLifecycleManager::
getConnection();
$database =
$conn->
fetchOne('select database();'
);
$migration =
new Migration1688717599UpdateCreatedByIdAndUpdatedByIdInOrderAndCustomer();
$migration->
update($conn);
/** @var array<array<string, mixed>> $customerForeignKeyInfoUpdated */
$customerForeignKeyInfoUpdated =
$conn->
fetchAllAssociative('SELECT * FROM information_schema.REFERENTIAL_CONSTRAINTS WHERE TABLE_NAME = "customer" AND REFERENCED_TABLE_NAME = "user" AND CONSTRAINT_SCHEMA = "' .
$database . '";'
);
static::
assertCount(2,
$customerForeignKeyInfoUpdated);
static::
assertEquals($customerForeignKeyInfoUpdated[0
]['CONSTRAINT_NAME'
], 'fk.customer.created_by_id'
);
static::
assertEquals($customerForeignKeyInfoUpdated[1
]['CONSTRAINT_NAME'
], 'fk.customer.updated_by_id'
);
static::
assertEquals($customerForeignKeyInfoUpdated[0
]['DELETE_RULE'
], 'SET NULL'
);
static::
assertEquals($customerForeignKeyInfoUpdated[1
]['DELETE_RULE'
], 'SET NULL'
);