Skip to content

Commit 67edeaa

Browse files
empty commit
1 parent 3ef9d19 commit 67edeaa

2 files changed

Lines changed: 6 additions & 13 deletions

File tree

src/Migration/Resources/Database/Index.php

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,12 @@
77

88
class Index extends Resource
99
{
10-
protected static string $timeStampFormatDb = 'Y-m-d H:i:s.v';
1110
public const TYPE_UNIQUE = 'unique';
1211

1312
public const TYPE_FULLTEXT = 'fulltext';
1413

1514
public const TYPE_KEY = 'key';
1615

17-
protected string $createdAt;
18-
protected string $updatedAt;
19-
2016
/**
2117
* @param string $id
2218
* @param string $key
@@ -25,7 +21,7 @@ class Index extends Resource
2521
* @param array<string> $attributes
2622
* @param array<int> $lengths
2723
* @param array<string> $orders
28-
* @param string|null $createdAt
24+
* @param string $createdAt
2925
* @param string $updatedAt
3026
*/
3127
public function __construct(
@@ -36,14 +32,10 @@ public function __construct(
3632
private readonly array $attributes = [],
3733
private readonly array $lengths = [],
3834
private readonly array $orders = [],
39-
?string $createdAt = null,
40-
?string $updatedAt = null,
35+
protected string $createdAt = "",
36+
protected string $updatedAt = "",
4137
) {
4238
$this->id = $id;
43-
$date = new \DateTime();
44-
$now = $date->format(self::$timeStampFormatDb);
45-
$this->$createdAt = $createdAt ?? $now;
46-
$this->$updatedAt = $updatedAt ?? $now;
4739
}
4840

4941
/**

src/Migration/Sources/Appwrite.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use Appwrite\Services\Teams;
1212
use Appwrite\Services\Users;
1313
use Utopia\Database\Database as UtopiaDatabase;
14+
use Utopia\Database\DateTime as DbDateTime;
1415
use Utopia\Migration\Exception;
1516
use Utopia\Migration\Resource;
1617
use Utopia\Migration\Resources\Auth\Hash;
@@ -921,8 +922,8 @@ private function exportIndexes(int $batchSize): void
921922
$index['attributes'],
922923
[],
923924
$index['orders'],
924-
$index['$createdAt'],
925-
$index['$updatedAt'],
925+
$index['$createdAt'] = empty($index['$createdAt']) ? DbDateTime::now() : $index['$createdAt'],
926+
$index['$updatedAt'] = empty($index['$updatedAt']) ? DbDateTime::now() : $index['$updatedAt'],
926927
);
927928
}
928929

0 commit comments

Comments
 (0)