First of all, when I fetched last version of yii-user from GIT (github.com, mishamx, yii-user) into my protected/modules directory, it creates a directory called ‘yii-user’ which appears to be a module. But the entire yii-user documentation uses ‘user’ as module name, so I decided to rename ‘yii-user’ to ‘user’ and many things started to work. If I was not supposed to rename, or having to rename, please tell me what I did wrong…
Second, and that’s why I’m here, I’m getting the following error when I issue the migrate command:
Am I missing some step, or is this a yii-user bug?
Hi. I figured out the problem. The db configuration of protected/config/console.php was wrong. As a newbie, I only configured db for protected/config/main.php. I guess that yiic migrate uses console.php configurations.
When I attempt to run the migration, it fails when attempting to apply m110810_162301_userTimestampFix. The error message is
> execute SQL: UPDATE {{users}} SET create_at = FROM_UNIXTIME(c
IF(lastvisit,FROM_UNIXTIME(lastvisit),'0000-00-00 00:00:00') ..
led to execute the SQL statement: SQLSTATE[42000]: Syntax error
You have an error in your SQL syntax; check the manual that corr
er version for the right syntax to use near '{users}} SET create
time), lastvisit_at = IF(lastvisit,' at line 1. The SQL statemen
sers}} SET create_at = FROM_UNIXTIME(createtime), lastvisit_at =
E(lastvisit),'0000-00-00 00:00:00') (L:\xampp\framework\db\CDbCo
L:\xampp\framework\db\CDbMigration.php(159): CDbCommand->execute
L:\xampp\htdocs\larrylutz\protected\modules\user\migrations\m110
x.php(24): CDbMigration->execute('UPDATE {{users}...')
L:\xampp\framework\db\CDbMigration.php(50): m110810_162301_userT
L:\xampp\framework\cli\commands\MigrateCommand.php(385): CDbMigr
L:\xampp\framework\cli\commands\MigrateCommand.php(109): Migrate
0_162301_...')
[internal function]: MigrateCommand->actionUp(Array)
L:\xampp\framework\console\CConsoleCommand.php(172): ReflectionM
igrateCommand), Array)
L:\xampp\framework\console\CConsoleCommandRunner.php(67): CConso
L:\xampp\framework\console\CConsoleApplication.php(91): CConsole
L:\xampp\framework\base\CApplication.php(169): CConsoleApplicati
L:\xampp\framework\yiic.php(33): CApplication->run()
L:\xampp\htdocs\larrylutz\protected\yiic.php(7): require_once('
{main}
failed to apply m110810_162301_userTimestampFix (time: 0.196s)
Also, are the tables created really supposed to be named {{profiles_fields}}, {{profiles}}, {{users}} (with the braces just as typed)? That’s what the migration created, and those names look really strange to me.