Skip to content
This repository was archived by the owner on Jul 16, 2021. It is now read-only.
This repository was archived by the owner on Jul 16, 2021. It is now read-only.

Make db schema dump migration work independent of mysql command #2638

@hugotiburtino

Description

@hugotiburtino

Developing with docker-compose got the following error:

$ docker-compose exec app php artisan migrate --seed --path=/database/migrations/legacy
Migration table created successfully.
Loading stored database schema: /var/www/html/database/schema/mysql-schema.dump

   Symfony\Component\Process\Exception\ProcessFailedException 

  The command "mysql  --user="${:LARAVEL_LOAD_USER}" --password="${:LARAVEL_LOAD_PASSWORD}" --host="${:LARAVEL_LOAD_HOST}" --port="${:LARAVEL_LOAD_PORT}" --database="${:LARAVEL_LOAD_DATABASE}" < "${:LARAVEL_LOAD_PATH}"" failed.

Exit Code: 127(Command not found)

Working directory: /var/www/html

Output:
================


Error Output:
================
sh: 1: mysql: not found

  at vendor/symfony/process/Process.php:267
    263▕      */
    264▕     public function mustRun(callable $callback = null, array $env = []): self
    265▕     {
    266▕         if (0 !== $this->run($callback, $env)) {
  ➜ 267▕             throw new ProcessFailedException($this);
    268▕         }
    269▕ 
    270▕         return $this;
    271▕     }

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

That happens because the app container does not have mysql server, which is run in another container.

Desired change:

  • run php artisan migrate and it works independent of the machine having mysql installed or not.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions