Skip to content

Instantly share code, notes, and snippets.

@higj
Created January 26, 2012 20:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save higj/1685042 to your computer and use it in GitHub Desktop.
Save higj/1685042 to your computer and use it in GitHub Desktop.
Yii Migration Tool v1.0 (based on Yii v1.1.9)
Total 7 new migrations to be applied:
m120107_225219_reg_date_null
m120107_230853_likes_table
m120108_174935_likes_ip_as_pk
m120110_001940_password_recovery
m120113_184432_qnaanswer_trigers
m120120_194333_last_answer_time
m120121_142901_last_login2last_visit
Apply the above migrations? [yes|no] yes
*** applying m120107_225219_reg_date_null
> alter column reg_date in table users to TIMESTAMP NULL DEFAULT NULL ... do
ne (time: 0.055s)
> update users ... done (time: 0.002s)
*** applied m120107_225219_reg_date_null (time: 0.093s)
*** applying m120107_230853_likes_table
> create table blog_likes ... done (time: 0.055s)
> add foreign key userid2users: blog_likes (userid) references users (id) ..
.Exception: CDbCommand failed to execute the SQL statement: SQLSTATE[HY000]: Gen
eral error: 1005 Can't create table 'phpguide.#sql-674_fc' (errno: 150). The SQL
statement executed was: ALTER TABLE `blog_likes` ADD CONSTRAINT `userid2users`
FOREIGN KEY (`userid`) REFERENCES `users` (`id`) ON DELETE cascade ON UPDATE cas
cade (C:\Server\www\framework\db\CDbCommand.php:354)
#0 C:\Server\www\framework\db\CDbCommand.php(1362): CDbCommand->execute()
#1 C:\Server\www\framework\db\CDbMigration.php(344): CDbCommand->addForeignKey('
userid2users', 'blog_likes', 'userid', 'users', 'id', 'cascade', 'cascade')
#2 C:\Server\www\phpguide\protected\migrations\m120107_230853_likes_table.php(15
): CDbMigration->addForeignKey('userid2users', 'blog_likes', 'userid', 'users',
'id', 'cascade', 'cascade')
#3 C:\Server\www\framework\db\CDbMigration.php(51): m120107_230853_likes_table->
safeUp()
#4 C:\Server\www\framework\cli\commands\MigrateCommand.php(362): CDbMigration->u
p()
#5 C:\Server\www\framework\cli\commands\MigrateCommand.php(100): MigrateCommand-
>migrateUp('m120107_230853_...')
#6 [internal function]: MigrateCommand->actionUp(Array)
#7 C:\Server\www\framework\console\CConsoleCommand.php(141): ReflectionMethod->i
nvokeArgs(Object(MigrateCommand), Array)
#8 C:\Server\www\framework\console\CConsoleCommandRunner.php(65): CConsoleComman
d->run(Array)
#9 C:\Server\www\framework\console\CConsoleApplication.php(91): CConsoleCommandR
unner->run(Array)
#10 C:\Server\www\framework\base\CApplication.php(162): CConsoleApplication->pro
cessRequest()
#11 C:\Server\www\framework\yiic.php(33): CApplication->run()
#12 C:\Server\www\phpguide\protected\yiic.php(7): require_once('C:\Server\www\f.
..')
#13 {main}
*** failed to apply m120107_230853_likes_table (time: 0.114s)
Migration failed. All later migrations are canceled.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment