I maintain a old Yii 1.1 application and I have created a new migration, but when I try to apply it, it fails. This is the second migration, while the first one worked fine.
The error I get is:
yiic.bat migrate
Yii Migration Tool v1.0 (based on Yii v1.1.17)
Creating migration history table "tbl_migration"...exception 'CDbException' with message 'CDbCommand failed to execute the SQL statement: SQLSTATE[42P07]: Duplicate table: 7 ERROR: relation "tbl_migration" already exists. The SQL statement executed was: CREATE TABLE "tbl_migration" (
"version" varchar(180) NOT NULL PRIMARY KEY,
"apply_time" integer
)' in c:\application\source\yii\framework\db\CDbCommand.php:358
Stack trace:
#0 c:\application\source\yii\framework\db\CDbCommand.php(1352): CDbCommand->execute()
#1 c:\application\source\yii\framework\cli\commands\MigrateCommand.php(501): CDbCommand-
>createTable('tbl_migration', Array)
#2 c:\application\source\yii\framework\cli\commands\MigrateCommand.php(484): MigrateComm
and->createMigrationHistoryTable()
#3 c:\application\source\yii\framework\cli\commands\MigrateCommand.php(512): MigrateComm
and->getMigrationHistory(-1)
#4 c:\application\source\yii\framework\cli\commands\MigrateCommand.php(84): MigrateComma
nd->getNewMigrations()
#5 [internal function]: MigrateCommand->actionUp(Array)
#6 c:\application\source\yii\framework\console\CConsoleCommand.php(172): ReflectionMetho
d->invokeArgs(Object(MigrateCommand), Array)
#7 c:\application\source\yii\framework\console\CConsoleCommandRunner.php(71): CConsoleCo
mmand->run(Array)
#8 c:\application\source\yii\framework\console\CConsoleApplication.php(92): CConsoleComm
andRunner->run(Array)
#9 c:\application\source\yii\framework\base\CApplication.php(185): CConsoleApplication->
processRequest()
#10 c:\application\source\yii\framework\yiic.php(33): CApplication->run()
#11 c:\application\source\app\protected\yiic.php(7): require_once('W:\\Projects\\par...'
)
#12 {main}
This is a PostgreSQL database, using a different than the default public schema. I suppose that this might be the issue, but could there be something else I’m missing?