diff options
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/deploy.sh | 14 | ||||
-rwxr-xr-x | bin/migrate | 19 |
2 files changed, 24 insertions, 9 deletions
diff --git a/bin/deploy.sh b/bin/deploy.sh index f1569a61..48808d5b 100755 --- a/bin/deploy.sh +++ b/bin/deploy.sh @@ -50,7 +50,7 @@ fi echo "syncing ${PWD}/ to ${remote_host}:${remote_path}/${deploy_id}/" -rsync -vAax --exclude '.git*' --exclude .composer/ \ +rsync -vAax --exclude '.git*' --exclude .composer/ --exclude coverage/ --exclude node_modules/ \ -e "ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" \ ./ "${remote_host}:${remote_path}/${deploy_id}/" @@ -58,15 +58,13 @@ ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no "${remote_hos set -e if [[ -f \"${remote_path}/current/config/config.php\" ]]; then - echo \"Config backup\" - cp \"${remote_path}/current/config/config.php\" \"${deploy_id}-config.php\" + echo \"Configuring\" + cp \"${remote_path}/current/config/config.php\" \"${remote_path}/${deploy_id}/config/config.php\" fi echo \"Changing symlink\" - unlink \"${remote_path}/current\" && ln -s \"${remote_path}/${deploy_id}\" \"${remote_path}/current\" + ln -nsf \"${remote_path}/${deploy_id}\" \"${remote_path}/current\" - if [[ -f \"${deploy_id}-config.php\" ]]; then - echo \"Restoring config\" - cp \"${deploy_id}-config.php\" \"${remote_path}/current/config/config.php\" - fi + echo \"Migrating\" + php \"${remote_path}/current/bin/migrate\" " diff --git a/bin/migrate b/bin/migrate index 20ae2a93..ab3598d4 100755 --- a/bin/migrate +++ b/bin/migrate @@ -18,4 +18,21 @@ $app->register(MigrationServiceProvider::class); /** @var Migrate $migration */ $migration = $app->get('db.migration'); $migration->setOutput(function ($text) { echo $text . PHP_EOL; }); -$migration->run($baseDir, Migrate::UP); + +if (isset($argv[1]) && strtolower($argv[1]) == 'help') { + echo PHP_EOL . 'Usage: ' . $argv[1] . ' [up|down] [one-step]' . PHP_EOL . PHP_EOL; + exit; +} + +$method = Migrate::UP; +if (isset($argv[1]) && strtolower($argv[1]) == 'down') { + $argv = array_values($argv); + $method = Migrate::DOWN; +} + +$oneStep = false; +if (isset($argv[2]) && strtolower($argv[2]) == 'one-step') { + $oneStep = true; +} + +$migration->run($baseDir, $method, $oneStep); |