[trick] share config cross web & console app

lately it took me a while to figure out why migration does not work till i open the default sqlite db;

i changed db in config/main.php while not at the same time in console.php, here is what i come up with small trick:

in config/console.php


//load main config

$_main = include_once( 'main.php' );

// This is the configuration for yiic console application.

// Any writable CConsoleApplication properties can be configured here.

return array(


	'name'=>'My Console Application',

	// application components


        //share db connection with webapp



	//	'connectionString' => 'sqlite:'.dirname(__FILE__).'/../data/testdrive.db',


	// uncomment the following to use a MySQL database



		'connectionString' => 'mysql:host=localhost;dbname=testdrive',

		'emulatePrepare' => true,

		'username' => 'root',

		'password' => '',

		'charset' => 'utf8',





[color="#008000"]NOTE: moved to proper section (Tips, Snippets and Tutorials instead of General Discussion for Yii 1.1.x)[/color]