Various updates

This commit is contained in:
2023-06-08 20:49:27 -04:00
parent 3ed5acf75e
commit 9307ba330c
45 changed files with 864 additions and 188 deletions

View File

@ -28,6 +28,23 @@ class Mailbox extends Repository
return $this;
}
public function install(): void
{
$query = "
CREATE TABLE {$this->getTable()} (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`mailbox_id` INT UNSIGNED NOT NULL,
`date_time` DATETIME NOT NULL,
`count` INT UNSIGNED NOT NULL,
`uids` TEXT NOT NULL,
PRIMARY KEY (`id`),
FOREIGN KEY `fk_mailboxes_{$this->getTable()}` (`mailbox_id`)
REFERENCES `mailboxes` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
)
";
$this->getConnection()->query($query);
}
protected function fieldsForUpdate(): array
{
return $this->fieldsForInsert();
@ -99,4 +116,4 @@ class Mailbox extends Repository
$query = "SELECT * FROM `{$this->getTable()}` WHERE `mailbox_id` = ? AND `date_time` = ?";
return $this->fetchOne($query, [$mailbox_id, $date_time]);
}
}
}