summaryrefslogtreecommitdiff
path: root/app/Console/DatabaseMigrationCommand.php
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2016-12-02 19:16:50 -0500
committerFrederic Guillot <fred@kanboard.net>2016-12-02 19:16:50 -0500
commitf2fd5d75d98e01ab58a71b718d630b9b2ae8e16f (patch)
tree6c691b5f0024b822df75a37644e804c864d8f8e7 /app/Console/DatabaseMigrationCommand.php
parentb5671a2dc04b63a8d7787b1137e72d7858955d98 (diff)
Add config parameter to toggle automatic SQL migrations
- Add two command line opterations to show schema version and to execute SQL migrations - Add new configuration parameter to enable or disable SQL migrations
Diffstat (limited to 'app/Console/DatabaseMigrationCommand.php')
-rw-r--r--app/Console/DatabaseMigrationCommand.php23
1 files changed, 23 insertions, 0 deletions
diff --git a/app/Console/DatabaseMigrationCommand.php b/app/Console/DatabaseMigrationCommand.php
new file mode 100644
index 00000000..252d4369
--- /dev/null
+++ b/app/Console/DatabaseMigrationCommand.php
@@ -0,0 +1,23 @@
+<?php
+
+namespace Kanboard\Console;
+
+use Kanboard\ServiceProvider\DatabaseProvider;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Output\OutputInterface;
+
+class DatabaseMigrationCommand extends DatabaseVersionCommand
+{
+ protected function configure()
+ {
+ $this
+ ->setName('db:migrate')
+ ->setDescription('Execute SQL migrations');
+ }
+
+ protected function execute(InputInterface $input, OutputInterface $output)
+ {
+ parent::execute($input, $output);
+ DatabaseProvider::runMigrations($this->container['db']);
+ }
+}