Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Some command fixes.
James Colee2e8ae5b28c5
diff --git a/.deploy/docker/entrypoint.sh b/.deploy/docker/entrypoint.shindex 2ddeb67624..4ff9f805a1 100755--- a/.deploy/docker/entrypoint.sh+++ b/.deploy/docker/entrypoint.sh@@ -54,8 +54,8 @@ if [[ ! -z "$DB_PORT" ]]; thenfi#env $(grep -v "^\#" .env | xargs)php artisan cache:clear-php artisan migrate --seedphp artisan firefly-iii:create-database+php artisan migrate --seedphp artisan firefly-iii:decrypt-all# there are 13 upgrade commandsdiff --git a/app/Console/Commands/CreateDatabase.php b/app/Console/Commands/CreateDatabase.phpindex f4fe3a4e19..613561fe2f 100644--- a/app/Console/Commands/CreateDatabase.php+++ b/app/Console/Commands/CreateDatabase.php@@ -50,16 +50,20 @@ class CreateDatabase extends Commandreturn 1;}// with PDO, try to list DB's (- $stmt = $pdo->prepare('SHOW DATABASES WHERE `Database` = ?');- $stmt->execute([env('DB_DATABASE')]);- $result = $stmt->fetch();- if (false === $result) {+ $stmt = $pdo->query('SHOW DATABASES;');+ $exists = false;+ // slightly more complex but less error prone.+ foreach ($stmt as $row) {+ $name = $row['Database'] ?? false;+ if ($name === env('DB_DATABASE')) {+ $exists = true;+ }+ }+ if (false === $exists) {$this->error(sprintf('Database "%s" does not exist.', env('DB_DATABASE')));// try to create it.- $stmt = $pdo->query(sprintf('CREATE DATABASE `%s` CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;', env('DB_DATABASE')));- $stmt->execute();- $stmt->fetch();+ $pdo->exec(sprintf('CREATE DATABASE `%s` CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;', env('DB_DATABASE')));$this->info(sprintf('Created database "%s"', env('DB_DATABASE')));return 0;