Various updates
This commit is contained in:
@ -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]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user