Skip to content

Commit

Permalink
fix check of file path
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Oct 21, 2020
1 parent 49c2374 commit 268237f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Illuminate/Database/Schema/PostgresSchemaState.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace Illuminate\Database\Schema;

use Illuminate\Support\Str;

class PostgresSchemaState extends SchemaState
{
/**
Expand Down Expand Up @@ -53,7 +55,7 @@ public function load($path)
{
$command = 'PGPASSWORD=$LARAVEL_LOAD_PASSWORD pg_restore --host=$LARAVEL_LOAD_HOST --port=$LARAVEL_LOAD_PORT --username=$LARAVEL_LOAD_USER --dbname=$LARAVEL_LOAD_DATABASE $LARAVEL_LOAD_PATH';

if (preg_match('/\.sql$/', $path) !== false) {
if (Str::endsWith($path, '.sql')) {
$command = 'PGPASSWORD=$LARAVEL_LOAD_PASSWORD psql --file=$LARAVEL_LOAD_PATH --host=$LARAVEL_LOAD_HOST --port=$LARAVEL_LOAD_PORT --username=$LARAVEL_LOAD_USER --dbname=$LARAVEL_LOAD_DATABASE';
}

Expand Down

0 comments on commit 268237f

Please sign in to comment.