[COMPONENT][Attachment] Entity should have default refCount value, every attachment starts with 1 life

This commit is contained in:
Diogo Peralta Cordeiro 2021-12-26 16:43:38 +00:00
parent 94e216a943
commit 8e7c94fe1d
Signed by: diogo
GPG Key ID: 18D2D35001FBFAB0
1 changed files with 2 additions and 2 deletions

View File

@ -59,7 +59,7 @@ class Attachment extends Entity
// {{{ Autocode
// @codeCoverageIgnoreStart
private int $id;
private int $lives;
private int $lives = 1;
private ?string $filehash;
private ?string $mimetype;
private ?string $filename;
@ -375,7 +375,7 @@ class Attachment extends Entity
'name' => 'attachment',
'fields' => [
'id' => ['type' => 'serial', 'not null' => true],
'lives' => ['type' => 'int', 'not null' => true, 'description' => 'RefCount'],
'lives' => ['type' => 'int', 'default' => 1, 'not null' => true, 'description' => 'RefCount, starts with 1'],
'filehash' => ['type' => 'varchar', 'length' => 64, 'description' => 'sha256 of the file contents, if the file is stored locally'],
'mimetype' => ['type' => 'varchar', 'length' => 255, 'description' => 'resource mime type 127+1+127 as per rfc6838#section-4.2'],
'filename' => ['type' => 'varchar', 'length' => 191, 'description' => 'file name of resource when available'],