Skip to content

Commit a8f66aa

Browse files
committed
fixup! fixup! feat(snowflake): Use string as type for snowflake ids
1 parent d15e008 commit a8f66aa

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/private/Preview/Db/Preview.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
use OCP\DB\Types;
1616
use OCP\Files\IMimeTypeDetector;
1717
use OCP\Server;
18-
use Override;
1918

2019
/**
2120
* Preview entity mapped to the oc_previews and oc_preview_locations table.
@@ -81,6 +80,7 @@ class Preview extends Entity {
8180
protected ?bool $encrypted = null;
8281

8382
public function __construct() {
83+
$this->addType('id', Types::STRING);
8484
$this->addType('fileId', Types::BIGINT);
8585
$this->addType('storageId', Types::BIGINT);
8686
$this->addType('oldFileId', Types::BIGINT);
@@ -96,8 +96,7 @@ public function __construct() {
9696
$this->addType('encrypted', Types::BOOLEAN);
9797
$this->addType('etag', Types::STRING);
9898
$this->addType('versionId', Types::STRING);
99-
$this->id = Server::get(ISnowflake::class)->nextId();
100-
$this->markFieldUpdated('id');
99+
$this->setId(Server::get(ISnowflake::class)->nextId());
101100
}
102101

103102
public static function fromPath(string $path, IMimeTypeDetector $mimeTypeDetector): Preview|false {

lib/public/AppFramework/Db/Entity.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
* @psalm-consistent-constructor
2020
*/
2121
abstract class Entity {
22-
public int|string|null $id = null;
22+
/** @var int $id */
23+
public $id = null;
2324

2425
private array $_updatedFields = [];
2526
/** @var array<string, \OCP\DB\Types::*> */

0 commit comments

Comments
 (0)