Replit Laravel template connection fail to ElephantSQL

Hi there! I’m using the Laravel template and I’m having trouble connecting to my ElephantSQL database with php artisan migrate. I’ve updated the laravel.env file:

DB_CONNECTION=pgsql
DB_HOST=bubble.db.elephantsql.com
DB_PORT=5432
DB_DATABASE=rmnvhmga
DB_USERNAME=rmnvhmga
+password

, but I’m getting an error message:

~/laravel-test-2$ php artisan migrate

   InvalidArgumentException 

  Unsupported driver [https].

  at vendor/laravel/framework/src/Illuminate/Database/Connectors/ConnectionFactory.php:274
    270▕             'mysql' => new MySqlConnection($connection, $database, $prefix, $config),
    271▕             'pgsql' => new PostgresConnection($connection, $database, $prefix, $config),
    272▕             'sqlite' => new SQLiteConnection($connection, $database, $prefix, $config),
    273▕             'sqlsrv' => new SqlServerConnection($connection, $database, $prefix, $config),
  ➜ 274▕             default => throw new InvalidArgumentException("Unsupported driver [{$driver}]."),
    275▕         };
    276▕     }
    277▕ }
    278▕ 

      +27 vendor frames 
  28  artisan:37
      Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

What could be the issue? My repl: https://replit.com/@ecsitomi/laravel-test-2

Thx!

Just so you know, that laravel.env file is publicly visible to everyone, if the data in it is sensitive, you should use Secrets

3 Likes

Thanks your answer. I wrote them into the Secrets but the problem is still the same :anguished:

It seems like it’s reading the wrong driver when you try to migrate it

Are you certain you’re passing it correctly to the program?

I wrote the DB_CONNECTION to pgsql. I don’t know where else to change the key for the migration to work. :frowning:

Perhaps this Stack Overflow post would help?

Thanks, I tried and got a new error message:

~/laravel-test-2$ php artisan migrate

   INFO  Preparing database.  

  Creating migration table .................................... 144ms DONE

   INFO  Running migrations.  

  2019_12_14_000001_create_personal_access_tokens_table ....... 273ms DONE
  2024_02_20_120023_create_todo_table .......................... 45ms FAIL

   BadMethodCallException 

  Method Illuminate\Database\Schema\Blueprint::increment does not exist.

  at vendor/laravel/framework/src/Illuminate/Macroable/Traits/Macroable.php:113
    109▕      */
    110▕     public function __call($method, $parameters)
    111▕     {
    112▕         if (! static::hasMacro($method)) {
  ➜ 113▕             throw new BadMethodCallException(sprintf(
    114▕                 'Method %s::%s does not exist.', static::class, $method
    115▕             ));
    116▕         }
    117▕ 

  i   Bad Method Call: Did you mean Illuminate\Database\Schema\Blueprint::increments() ? 

  1   database/migrations/2024_02_20_120023_create_todo_table.php:17
      Illuminate\Database\Schema\Blueprint::__call("increment")

      +4 vendor frames 
  6   database/migrations/2024_02_20_120023_create_todo_table.php:21
      Illuminate\Support\Facades\Facade::__callStatic("create")
1 Like