Skip to content

Commit 23e404d

Browse files
committed
fix: use int_bool cast to fix type error on PostgreSQL
pg_query(): Query failed: ERROR: column "active" is of type smallint but expression is of type boolean LINE 1: UPDATE "users" SET "active" = TRUE, "updated_at" = '2022-07-...
1 parent 6f2887f commit 23e404d

File tree

3 files changed

+3
-7
lines changed

3 files changed

+3
-7
lines changed

src/Entities/Login.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,13 @@
22

33
namespace CodeIgniter\Shield\Entities;
44

5-
use CodeIgniter\Entity\Entity;
6-
75
class Login extends Entity
86
{
97
/**
108
* @var array<string, string>
119
*/
1210
protected $casts = [
1311
'date' => 'datetime',
14-
'success' => 'boolean',
12+
'success' => 'int_bool',
1513
];
1614
}

src/Entities/User.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace CodeIgniter\Shield\Entities;
44

55
use CodeIgniter\Database\Exceptions\DataException;
6-
use CodeIgniter\Entity\Entity;
76
use CodeIgniter\Shield\Authentication\Authenticators\Session;
87
use CodeIgniter\Shield\Authentication\Traits\HasAccessTokens;
98
use CodeIgniter\Shield\Authorization\Traits\Authorizable;
@@ -41,7 +40,7 @@ class User extends Entity
4140
*/
4241
protected $casts = [
4342
'id' => '?integer',
44-
'active' => 'boolean',
43+
'active' => 'int_bool',
4544
'permissions' => 'array',
4645
'groups' => 'array',
4746
];

src/Entities/UserIdentity.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace CodeIgniter\Shield\Entities;
44

5-
use CodeIgniter\Entity\Entity;
65
use CodeIgniter\Shield\Authentication\Passwords;
76

87
/**
@@ -25,7 +24,7 @@ class UserIdentity extends Entity
2524
* @var array<string, string>
2625
*/
2726
protected $casts = [
28-
'force_reset' => 'boolean',
27+
'force_reset' => 'int_bool',
2928
];
3029

3130
/**

0 commit comments

Comments
 (0)