Various updates
This commit is contained in:
@ -29,6 +29,21 @@ class Job extends Repository
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function install(): void
|
||||
{
|
||||
$query = "
|
||||
CREATE TABLE {$this->getTable()} (
|
||||
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`message_id` INT UNSIGNED NOT NULL,
|
||||
`date_time` DATETIME NOT NULL,
|
||||
`executed` INT(1) UNSIGNED DEFAULT 0,
|
||||
PRIMARY KEY (`id`),
|
||||
FOREIGN KEY `fk_messages_{$this->getTable()}` (`message_id`)
|
||||
REFERENCES `messages` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
|
||||
)";
|
||||
$this->getConnection()->query($query);
|
||||
}
|
||||
|
||||
protected function fieldsForUpdate(): array
|
||||
{
|
||||
return $this->fieldsForInsert();
|
||||
@ -105,4 +120,4 @@ class Job extends Repository
|
||||
$query = "SELECT * FROM {$this->getTable()} WHERE `message_id` = ? AND `executed` = 0";
|
||||
return $this->fetchOne($query, [$message_id]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user