Skip to content

Commit

Permalink
Adjust constant name & support exports in migration list view
Browse files Browse the repository at this point in the history
  • Loading branch information
yhabteab committed Jul 26, 2023
1 parent 42df74c commit f54df07
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
6 changes: 4 additions & 2 deletions application/controllers/StatusController.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,10 @@ public function migrationListAction()
$this->setupFilterControl($migrations, [
'name' => $this->translate('Name'),
'state' => $this->translate('State'),
], ['name']);
], ['name'], ['format']);

$this->getTabs()->extend(new OutputFormat(['csv']));
$this->handleFormatRequest($migrations);

$this->addControl(HtmlString::create((string) $this->view->paginator));
$this->addControl(HtmlElement::create('div', ['class' => 'sort-controls-container'], [
Expand All @@ -95,7 +98,6 @@ public function migrationListAction()

$this->initTabs();
$this->getTabs()->activate('migrations');
$this->getTabs()->disableLegacyExtensions();

$this->setAutorefreshInterval(30);
$this->addContent(new Migrations($migrations, function (Form $form) {
Expand Down
9 changes: 6 additions & 3 deletions library/Icinga/Application/Hook/MigrationHook.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ abstract class MigrationHook implements Countable
public const ALL_MODULES = 'all_modules';

/** @var string Used as the initial migration version when the schema version table doesn't exist yet */
protected const INITIAL_MIGRATE_VERSION = '0.0.0';
protected const VERSION_BEFORE_AUTO_MIGRATE_SUPPORT = '0.0.0';

/** @var Migration[] All pending DB/PHP code migrations of this hook */
protected $migrations = [];
Expand Down Expand Up @@ -141,7 +141,7 @@ public function getVersion(): string
} else {
if (! $this->migrationStorage->has(static::MIGRATE_PHP_FILE)) {
// Create the cache file with some dummy/lower version.
$this->migrationStorage->create(static::MIGRATE_PHP_FILE, static::INITIAL_MIGRATE_VERSION);
$this->migrationStorage->create(static::MIGRATE_PHP_FILE, static::VERSION_BEFORE_AUTO_MIGRATE_SUPPORT);
}

$version = $this->migrationStorage->read(static::MIGRATE_PHP_FILE);
Expand Down Expand Up @@ -378,7 +378,10 @@ final protected function createSchemaVersionTable(): self
}

$conn->exec($query);
$conn->insert('schema_version', ['version' => static::INITIAL_MIGRATE_VERSION, 'timestamp' => $timestamp]);
$conn->insert('schema_version', [
'version' => static::VERSION_BEFORE_AUTO_MIGRATE_SUPPORT,
'timestamp' => $timestamp
]);

return $this;
}
Expand Down

0 comments on commit f54df07

Please sign in to comment.