Skip to content

Commit

Permalink
j2 fix mysql type mismatch
Browse files Browse the repository at this point in the history
  • Loading branch information
mvorisek committed May 29, 2024
1 parent bdcabea commit 635998e
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions tests/JoinSqlTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,14 @@ public function testJoinSaving1(): void
$user = new Model($this->db, ['table' => 'user']);
$this->setDb([
'user' => [
'_types' => ['name' => 'string', 'contact_id' => 'integer'],
'_types' => ['name' => 'string', 'contact_id' => 'bigint'],
],
'contact' => [
'_types' => ['contact_phone' => 'string'],
],
]);

$user->addField('contact_id', ['type' => 'integer']);
$user->addField('contact_id', ['type' => 'bigint']);
$user->addField('name');
$j = $user->join('contact');
$this->assertMigratorResolveRelation('user.contact_id', 'contact.id', $j);
Expand Down Expand Up @@ -164,7 +164,7 @@ public function testJoinSaving2(): void
'_types' => ['name' => 'string'],
],
'contact' => [
'_types' => ['contact_phone' => 'string', 'test_id' => 'integer'],
'_types' => ['contact_phone' => 'string', 'test_id' => 'bigint'],
],
]);

Expand Down Expand Up @@ -234,7 +234,7 @@ public function testJoinSaving3(): void
$user = new Model($this->db, ['table' => 'user']);
$this->setDb([
'user' => [
'_types' => ['name' => 'string', 'test_id' => 'integer'],
'_types' => ['name' => 'string', 'test_id' => 'bigint'],
],
'contact' => [
'_types' => ['contact_phone' => 'string'],
Expand Down Expand Up @@ -315,7 +315,7 @@ public function testJoinUpdate(): void
]);

$user = new Model($this->db, ['table' => 'user']);
$user->addField('contact_id', ['type' => 'integer']);
$user->addField('contact_id', ['type' => 'bigint']);
$user->addField('name');
$j = $user->join('contact');
$this->createMigrator()->createForeignKey($j);
Expand Down Expand Up @@ -410,7 +410,7 @@ public function testJoinDelete(): void
]);

$user = new Model($this->db, ['table' => 'user']);
$user->addField('contact_id', ['type' => 'integer']);
$user->addField('contact_id', ['type' => 'bigint']);
$user->addField('name');
$j = $user->join('contact');
$this->createMigrator()->createForeignKey($j);
Expand Down Expand Up @@ -467,7 +467,7 @@ public function testDoubleSaveHook(): void
'_types' => ['name' => 'string'],
],
'contact' => [
'_types' => ['contact_phone' => 'string', 'test_id' => 'integer'],
'_types' => ['contact_phone' => 'string', 'test_id' => 'bigint'],
],
]);

Expand Down Expand Up @@ -521,7 +521,7 @@ public function testDoubleJoin(): void
]);

$user = new Model($this->db, ['table' => 'user']);
$user->addField('contact_id', ['type' => 'integer']);
$user->addField('contact_id', ['type' => 'bigint']);
$user->addField('name');
$jContact = $user->join('contact');
$this->assertMigratorResolveRelation('user.contact_id', 'contact.id', $jContact);
Expand Down Expand Up @@ -810,7 +810,7 @@ public function testJoinActualFieldNamesAndPrefix(): void
]);

$user = new Model($this->db, ['table' => 'user']);
$user->addField('contact_id', ['type' => 'integer', 'actual' => $contactForeignIdFieldName]);
$user->addField('contact_id', ['type' => 'bigint', 'actual' => $contactForeignIdFieldName]);
$user->addField('name', ['actual' => 'first_name']);
// normal join
$j = $user->join('contact', ['prefix' => 'j1_']);
Expand Down

0 comments on commit 635998e

Please sign in to comment.