-
Notifications
You must be signed in to change notification settings - Fork 154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
migration creates tables named {{users}} {{profiles}} and {{profiles_fields}} and then fails #45
Comments
You need to set a |
I did! |
Just to be clear, I added 'tablePrefix' => 'tbl_', to the 'db' array in the components array in config/main.php |
Which version did you download? |
the version linked on the extensions yii site - yii-user-0.3-61-gfc69518 I will grab the zip from github and try that |
Unfortunately, same result |
Sorry, I had a similar error once, but I can't remember of anything else. |
well, I'm running this on MAMP PRO, so config/main.php IS a local file.... Thanks for your help anyhow! SOLVED: I added 'tablePrefix' => 'tbl_' to the 'db' section of config/console.php and now it works!.... |
My suggestion would be to add this solution to the instructions, as they only mention adding 'tablePrefix' => 'tbl_', to the main.php and not to console.php |
Yes that was it! Now I remember :) |
I ran the migration command as per the readme.md and it failed... here is the output
Creating migration history table "tbl_migration"...done.
Total 2 new migrations to be applied:
m110805_153437_installYiiUser
m110810_162301_userTimestampFix
Apply the above migrations? (yes|no) [no]:yes
*** applying m110805_153437_installYiiUser
type db: mysql
> create table {{users}} ... done (time: 0.093s)
> create unique index user_username on {{users}} (username) ... done (time: 0.165s)
> create unique index user_email on {{users}} (email) ... done (time: 0.103s)
> create table {{profiles}} ... done (time: 0.130s)
> add foreign key user_profile_id: {{profiles}} (user_id) references {{users}} (id) ... done (time: 0.149s)
> create table {{profiles_fields}} ... done (time: 0.109s)
Admin login [admin]:
Admin email [[email protected]]:
Admin password [admin]:
> insert into {{users}} ... done (time: 0.002s)
> insert into {{profiles}} ... done (time: 0.001s)
> insert into {{profiles_fields}} ... done (time: 0.001s)
> insert into {{profiles_fields}} ... done (time: 0.001s)
*** applied m110805_153437_installYiiUser (time: 17.428s)
*** applying m110810_162301_userTimestampFix
type db: mysql
> add column create_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP to table {{users}} ... done (time: 0.110s)
> add column lastvisit_at TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00' to table {{users}} ... done (time: 0.211s)
> execute SQL: UPDATE {{users}} SET create_at = FROM_UNIXTIME(createtime), lastvisit_at = IF(lastvisit,FROM_UNIXTIME(lastvisit),'0000-00-00 00:00:00') ...Exception: CDbCommand failed to execute the SQL statement: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '{users}} SET create_at = FROM_UNIXTIME(createtime), lastvisit_at = IF(lastvisit,' at line 1. The SQL statement executed was: UPDATE {{users}} SET create_at = FROM_UNIXTIME(createtime), lastvisit_at = IF(lastvisit,FROM_UNIXTIME(lastvisit),'0000-00-00 00:00:00') (/Applications/MAMP/htdocs/yii-1.1.13.e9e4a0/framework/db/CDbCommand.php:357)
#0 /Applications/MAMP/htdocs/yii-1.1.13.e9e4a0/framework/db/CDbMigration.php(159): CDbCommand->execute(Array)
#1 /Applications/MAMP/htdocs/yii1.1/protected/modules/user/migrations/m110810_162301_userTimestampFix.php(24): CDbMigration->execute('UPDATE {{users}...')
#2 /Applications/MAMP/htdocs/yii-1.1.13.e9e4a0/framework/db/CDbMigration.php(50): m110810_162301_userTimestampFix->safeUp()
#3 /Applications/MAMP/htdocs/yii-1.1.13.e9e4a0/framework/cli/commands/MigrateCommand.php(385): CDbMigration->up()
#4 /Applications/MAMP/htdocs/yii-1.1.13.e9e4a0/framework/cli/commands/MigrateCommand.php(109): MigrateCommand->migrateUp('m110810_162301_...')
#5 [internal function]: MigrateCommand->actionUp(Array)
#6 /Applications/MAMP/htdocs/yii-1.1.13.e9e4a0/framework/console/CConsoleCommand.php(172): ReflectionMethod->invokeArgs(Object(MigrateCommand), Array)
#7 /Applications/MAMP/htdocs/yii-1.1.13.e9e4a0/framework/console/CConsoleCommandRunner.php(67): CConsoleCommand->run(Array)
#8 /Applications/MAMP/htdocs/yii-1.1.13.e9e4a0/framework/console/CConsoleApplication.php(91): CConsoleCommandRunner->run(Array)
#9 /Applications/MAMP/htdocs/yii-1.1.13.e9e4a0/framework/base/CApplication.php(169): CConsoleApplication->processRequest()
#10 /Applications/MAMP/htdocs/yii-1.1.13.e9e4a0/framework/yiic.php(33): CApplication->run()
#11 /Applications/MAMP/htdocs/yii1.1/protected/yiic.php(7): require_once('/Applications/M...')
#12 /Applications/MAMP/htdocs/yii1.1/protected/yiic(4): require_once('/Applications/M...')
#13 {main}
*** failed to apply m110810_162301_userTimestampFix (time: 0.323s)
Migration failed. All later migrations are canceled.
Somehow, I can't imagine that {{users}} {{profiles}} and {{profiles_fields}} are the correct table names...
Any ideas what went wrong??
The text was updated successfully, but these errors were encountered: