CakePHP Migration getting failed


#1

Hi,

My CakePHP Migrations are getting failed. Following is my circle.yml code :

 machine:
  services:
    - rabbitmq-server
    - redis
    - mysql

  environment:
    AMQP_URL: amqp://localhost:5672

general:
  build_dir: app

dependencies:
  pre:
    - composer install --prefer-source --no-interaction
    - mkdir -p $HOME/$CIRCLE_PROJECT_REPONAME/app/tmp/logs
    - chmod 777 $HOME/$CIRCLE_PROJECT_REPONAME/app/tmp/logs
    - cp -R $HOME/$CIRCLE_PROJECT_REPONAME/app/Config/CircleCi/Config/* $HOME/$CIRCLE_PROJECT_REPONAME/app/Config/

database:
  override:
    - mysql -u root -e "create database buildserver_db"
    - mysql -u root -e "create database buildserver_db_test"
     - mysql -u root buildserver_db < $HOME/$CIRCLE_PROJECT_REPONAME/db_dumps/test_ab.sql
    - ./Console/cake Migrations.migration run all

test:
  override:
    - ./Console/cake test app CustomTestSuit

Following is code of database.php file ::

`class DATABASE_CONFIG {

	public $default = array(
		'datasource' => 'Database/Mysql',
		'persistent' => false,
		'host' => 'localhost',
		'login' => 'root',
		'password' => 'mypass',
		'unix_socket' => '/var/run/mysqld/mysqld.sock'
		'database' => 'buildserver_db',
		'prefix' => '',
		//'encoding' => 'utf8',
	);

	public $test = array(
		'datasource' => 'Database/Mysql',
		'persistent' => false,
		'host' => 'localhost',
		'login' => 'root',
		'password' => 'mypass',
		'unix_socket' => '/var/run/mysqld/mysqld.sock'
		'database' => 'buildserver_db_test',
		'prefix' => '',
		//'encoding' => 'utf8',
	);
}` 

I am getting following error for migrations ::

./Console/cake Migrations.migration run all
Cake Migration Shell
---------------------------------------------------------------
Error: Database connection "Mysql" is missing, or could not be created.

./Console/cake Migrations.migration run all returned exit code 244
./Console/cake Migrations.migration run all returned exit code 244

Action failed: ./Console/cake Migrations.migration run all

Action failed: ./Console/cake Migrations.migration run all 

Please help me. Am I missing anything?
Thanks in Advanced :slight_smile:


#2