How to change Migration Table name and use defined prefix.

You are viewing revision #3 of this wiki article.
This version may not be up to date with the latest version.
You may want to view the differences to the latest version or see the changes made in this revision.

« previous (#2)next (#4) »

To accomplish the task of changing Migration table's name, by default tbl_migration, you need to add the following in your ./protected/config/console.php.

// Command Map
  'commandMap'=>array(
    'migrate'=>array(
      'class'=>'system.cli.commands.MigrateCommand','
      'migrationPath'=>'application.migrations',
      'migrationTable'=>'{{migration_history}}',
      'connectionID'=>'db',
      'templateFile'=>'application.migrations.template',
    ),
  ),

The {{ }} makes Yii to use the prefix defined in the 'db' component defined in the same file. This piece of code must be contained by the first array, do not put it under 'components' array.

'components'=>array(
  'db'=>array(
	'connectionString' => 'mysql:host=localhost;dbname=directar',
	'emulatePrepare' => true,
	'username' => 'root',
	'password' => '010101',
	'charset' => 'utf8',
    'tablePrefix' => 'directar_'
	),
  ....
  ),
3 0
5 followers
Viewed: 21 686 times
Version: Unknown (update)
Category: How-tos
Written by: Jorgee
Last updated by: jamband
Created on: Apr 10, 2013
Last updated: 10 years ago
Update Article

Revisions

View all history

Related Articles