diff --git a/application/forms/ApplyMigrationsForm.php b/application/forms/ApplyMigrationsForm.php new file mode 100644 index 00000000..c1d954e4 --- /dev/null +++ b/application/forms/ApplyMigrationsForm.php @@ -0,0 +1,37 @@ +setSubmitLabel($this->translate('Apply schema migrations')); + } + + public function onSuccess() + { + try { + $this->setSuccessMessage($this->translate( + 'Pending database schema migrations have successfully been applied' + )); + + $this->migrations->applyPendingMigrations(); + parent::onSuccess(); + } catch (Exception $e) { + $this->addError($e->getMessage()); + } + } + + public function setMigrations(Migrations $migrations) + { + $this->migrations = $migrations; + return $this; + } +}