2024-12-17 04:40:35 -05:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
/* Icinga DB Web | (c) 2024 Icinga GmbH | GPLv2 */
|
|
|
|
|
|
|
|
|
|
namespace Icinga\Module\Icingadb\Model;
|
|
|
|
|
|
|
|
|
|
use DateTime;
|
|
|
|
|
use ipl\Orm\Behavior\Binary;
|
|
|
|
|
use ipl\Orm\Behavior\MillisecondTimestamp;
|
|
|
|
|
use ipl\Orm\Behaviors;
|
2025-10-16 02:42:51 -04:00
|
|
|
use Icinga\Module\Icingadb\Common\Model;
|
2024-12-17 04:40:35 -05:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Schema model
|
|
|
|
|
*
|
|
|
|
|
* @property string $id
|
|
|
|
|
* @property int $version
|
|
|
|
|
* @property DateTime $timestamp
|
|
|
|
|
*/
|
|
|
|
|
class Schema extends Model
|
|
|
|
|
{
|
|
|
|
|
public function getTableName(): string
|
|
|
|
|
{
|
|
|
|
|
return 'icingadb_schema';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getKeyName(): string
|
|
|
|
|
{
|
|
|
|
|
return 'id';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getColumns(): array
|
|
|
|
|
{
|
|
|
|
|
return [
|
|
|
|
|
'version',
|
|
|
|
|
'timestamp'
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getDefaultSort(): array
|
|
|
|
|
{
|
|
|
|
|
return ['timestamp desc'];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function createBehaviors(Behaviors $behaviors): void
|
|
|
|
|
{
|
|
|
|
|
$behaviors->add(new Binary(['id']));
|
|
|
|
|
$behaviors->add(new MillisecondTimestamp(['timestamp']));
|
|
|
|
|
}
|
|
|
|
|
}
|