Rename `Common\DbMigration` -> `DbMigrationStep`
This commit is contained in:
parent
2657f032dc
commit
ce89d4a7cb
|
@ -7,7 +7,7 @@ namespace Icinga\Application\Hook\Common;
|
|||
use ipl\Sql\Connection;
|
||||
use RuntimeException;
|
||||
|
||||
class DbMigration
|
||||
class DbMigrationStep
|
||||
{
|
||||
/** @var string The sql string to be executed */
|
||||
protected $query;
|
||||
|
@ -65,7 +65,7 @@ class DbMigration
|
|||
*
|
||||
* @param ?string $description
|
||||
*
|
||||
* @return DbMigration
|
||||
* @return DbMigrationStep
|
||||
*/
|
||||
public function setDescription(?string $description): self
|
||||
{
|
|
@ -9,7 +9,7 @@ use DateTime;
|
|||
use DirectoryIterator;
|
||||
use Exception;
|
||||
use Icinga\Application\ClassLoader;
|
||||
use Icinga\Application\Hook\Common\DbMigration;
|
||||
use Icinga\Application\Hook\Common\DbMigrationStep;
|
||||
use Icinga\Application\Icinga;
|
||||
use Icinga\Application\Logger;
|
||||
use Icinga\Application\Modules\Module;
|
||||
|
@ -51,7 +51,7 @@ abstract class MigrationHook implements Countable
|
|||
|
||||
public const ALL_MIGRATIONS = 'all-migrations';
|
||||
|
||||
/** @var ?array<string, DbMigration> All pending database migrations of this hook */
|
||||
/** @var ?array<string, DbMigrationStep> All pending database migrations of this hook */
|
||||
protected $migrations;
|
||||
|
||||
/** @var ?string The current version of this hook */
|
||||
|
@ -141,7 +141,7 @@ abstract class MigrationHook implements Countable
|
|||
/**
|
||||
* Get all the pending migrations of this hook
|
||||
*
|
||||
* @return DbMigration[]
|
||||
* @return DbMigrationStep[]
|
||||
*/
|
||||
public function getMigrations(): array
|
||||
{
|
||||
|
@ -159,7 +159,7 @@ abstract class MigrationHook implements Countable
|
|||
*
|
||||
* @param int $limit
|
||||
*
|
||||
* @return DbMigration[]
|
||||
* @return DbMigrationStep[]
|
||||
*/
|
||||
public function getLatestMigrations(int $limit): array
|
||||
{
|
||||
|
@ -282,7 +282,7 @@ abstract class MigrationHook implements Countable
|
|||
foreach (new DirectoryIterator($path . DIRECTORY_SEPARATOR . $upgradeDir) as $file) {
|
||||
if (preg_match('/^(?:r|v)?((?:\d+\.){0,2}\d+)(?:_([\w+]+))?\.sql$/', $file->getFilename(), $m)) {
|
||||
if (version_compare($m[1], $version, '>')) {
|
||||
$migration = new DbMigration($m[1], $file->getRealPath());
|
||||
$migration = new DbMigrationStep($m[1], $file->getRealPath());
|
||||
if (isset($descriptions[$migration->getVersion()])) {
|
||||
$migration->setDescription($descriptions[$migration->getVersion()]);
|
||||
} elseif (isset($m[2])) {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
namespace Icinga\Web\Widget\ItemList;
|
||||
|
||||
use Icinga\Application\Hook\Common\DbMigration;
|
||||
use Icinga\Application\Hook\Common\DbMigrationStep;
|
||||
use ipl\Html\Attributes;
|
||||
use ipl\Html\BaseHtmlElement;
|
||||
use ipl\Html\Html;
|
||||
|
@ -20,7 +20,7 @@ class MigrationFileListItem extends BaseListItem
|
|||
{
|
||||
use Translation;
|
||||
|
||||
/** @var DbMigration Just for type hint */
|
||||
/** @var DbMigrationStep Just for type hint */
|
||||
protected $item;
|
||||
|
||||
protected function assembleVisual(BaseHtmlElement $visual): void
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
namespace Icinga\Web\Widget\ItemList;
|
||||
|
||||
use Generator;
|
||||
use Icinga\Application\Hook\Common\DbMigration;
|
||||
use Icinga\Application\Hook\Common\DbMigrationStep;
|
||||
use Icinga\Application\Hook\MigrationHook;
|
||||
use Icinga\Application\MigrationManager;
|
||||
use Icinga\Forms\MigrationForm;
|
||||
|
@ -31,7 +31,7 @@ class MigrationList extends BaseItemList
|
|||
/**
|
||||
* Create a new migration list
|
||||
*
|
||||
* @param Generator<MigrationHook>|array<DbMigration|MigrationHook> $data
|
||||
* @param Generator<MigrationHook>|array<DbMigrationStep|MigrationHook> $data
|
||||
*
|
||||
* @param ?MigrationForm $form
|
||||
*/
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
namespace Icinga\Web\Widget\ItemList;
|
||||
|
||||
use Icinga\Application\Hook\Common\DbMigration;
|
||||
use Icinga\Application\Hook\Common\DbMigrationStep;
|
||||
use Icinga\Application\Hook\MigrationHook;
|
||||
use ipl\Html\Attributes;
|
||||
use ipl\Html\BaseHtmlElement;
|
||||
|
@ -69,7 +69,7 @@ class MigrationListItem extends BaseListItem
|
|||
protected function assembleCaption(BaseHtmlElement $caption): void
|
||||
{
|
||||
$migrations = $this->item->getMigrations();
|
||||
/** @var DbMigration $migration */
|
||||
/** @var DbMigrationStep $migration */
|
||||
$migration = array_shift($migrations);
|
||||
if ($migration->getLastState()) {
|
||||
if ($migration->getDescription()) {
|
||||
|
|
Loading…
Reference in New Issue