I use MySQL and migrations in Travis without any issues.
MySQL on Travis binds to 127.0.0.1 and using 'localhost' doesn't work.
You're using .env.testing.php, but you're not telling artisan that it's running in that environment - try adding --env=testing to all the artisan calls.
No need to create a db user, just use root with an empty password.
I wouldn't bother with a shell script personally, just use mysql -e in before_script to create the db.
Here is my known working .travis.yml file - very similar to yours - maybe it'll help:
language: php
php:
- 5.6
- 5.5
before_script:
- mv travis.env.php .env.testing.php
- mysql -e 'create database defdx;'
- composer self-update
- composer install --dev --prefer-source --no-interaction
- chmod -R 777 app/storage
- php artisan migrate:install --env=testing --no-interaction -vvv
script:
- php artisan migrate --env=testing --no-interaction -vvv
- php artisan db:seed --env=testing --no-interaction -vvv
- vendor/bin/codecept run functional
- php artisan migrate:rollback --env=testing --no-interaction -vvv
matrix:
fast_finish: true
My travis.env.php file:
<?php
return [
'DB_HOST' => '127.0.0.1',
'DB_NAME' => 'defdx',
'DB_USER' => 'root',
'DB_PASS' => ''
];
And the mysql config in the connections array in database.php:
'mysql' => array(
'driver' => 'mysql',
'host' => getenv('DB_HOST'),
'database' => getenv('DB_NAME'),
'username' => getenv('DB_USER'),
'password' => getenv('DB_PASS'),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
)
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community