Laravel 部署失败,因为迁移

Laravel deploy fails because migrate

这是我的部署脚本的一部分,不幸的是失败了:

image: php:7-fpm

pipelines:
  branches:  # Pipelines that run automatically on a commit to a branch
    staging:
      - step:
          script:
            - apt-get update && apt-get install -y unzip python-dev git
            - apt-get install -qy git curl libmcrypt-dev mysql-client
            - docker-php-ext-install mcrypt && docker-php-ext-install pdo_mysql
            - ./install-composer.sh
            - composer install
            - export APP_ENV=QA
            - export S3_ACCESS_KEY_ID=AAAAA
            - export S3_BUCKET_ASSETS=AAAAA
            - export S3_DEFAULT_CDN_BASE=AAAAA
            - export S3_REGION=eu-west-1
            - export S3_SECRET_ACCESS_KEY=AAAAA
            - curl -O https://bootstrap.pypa.io/get-pip.py
            - python get-pip.py
            - pip install awsebcli --upgrade
            - eb init this-data -r eu-central-1 -p PHP
            - eb setenv APP_ENV=QA JS_PATH=AAAA IMAGES_PATH=AAAAA FONTS_PATH=AAAA                - eb setenv SES_KEY=AAAAA
            - eb printenv
            - export CACHE_DRIVER=redis
            - export SESSION_DRIVER=redis
            - export DB_CONNECTION=mysql
            - php artisan migrate
            - php artisan serve
            - eb deploy this-staging-env
          services:
            - mysql

definitions:
      services:
              mysql:
                image: mysql
                environment:
                  MYSQL_DATABASE: 'thisdb'
                  MYSQL_RANDOM_ROOT_PASSWORD: 'yes'
                  MYSQL_USER: 'thisuser'
                  MYSQL_PASSWORD: 'thispass'
                  MYSQL_HOST: 'rdsInstance'

出现的消息是:

php artisan migrate

Illuminate\Database\QueryException : could not find driver (SQL: select * from information_schema.tables where table_schema = forge and table_name = migrations) at /opt/atlassian/pipelines/agent/build/vendor/laravel/framework/src/Illuminate/

我的解决方案是将其添加到 .ebextensions/init.config:

container_commands:
    01initdb:
        command: "php artisan migrate"

这意味着迁移命令在部署之后运行。