Yii2 Auth Module无法安装

时间:2014-11-03 09:57:45

标签: php authentication yii-extensions yii2

我正在尝试安装Auth Module 我已经按照evry步骤,安装成功了我修改了console / configue / mail.php

但是在迁移时我收到此错误消息

c:\wamp\www\****>php yii migrate/up --migrationPath=@auth/migrations
Yii Migration Tool (based on Yii v2.0.0)

Total 2 new migrations to be applied:
    m000000_000002_CreateUserTables
    m000000_000003_ChangeTokenColumn

Apply the above migrations? (yes|no) [no]:yes
*** applying m000000_000002_CreateUserTables
    > create table user ...Exception: SQLSTATE[42S01]: Base table or view alread
y exists: 1050 Table 'user' already exists
The SQL being executed was: CREATE TABLE `user` (
        `id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
        `username` varchar(64) NOT NULL,
        `email` varchar(128) NOT NULL,
        `password_hash` varchar(128) NOT NULL,
        `password_reset_token` varchar(32),
        `auth_key` varchar(128),
        `status` int(11) NOT NULL DEFAULT 2,
        `last_visit_time` timestamp,
        `create_time` timestamp NOT NULL,
        `update_time` timestamp,
        `delete_time` timestamp
) (C:\wamp\www\*****\vendor\yiisoft\yii2\db\Schema.php:532)
#0 C:\wamp\www\*****\vendor\yiisoft\yii2\db\Command.php(776): yii\db\Schema->convertException(Object(PDOException), 'CREATE TABLE `u...')
#1 C:\wamp\www\*****\vendor\yiisoft\yii2\db\Migration.php(245): yii\db\Command->execute()
#2 C:\wamp\www\*****\vendor\robregonm\yii2-auth\migrations\m000000_000002_CreateUserTables.php(27): yii\db\Migration->createTable('user', Array)
#3 C:\wamp\www\*****\vendor\yiisoft\yii2\db\Migration.php(78): m000000_000002_CreateUserTables->safeUp()
#4 C:\wamp\www\*****\vendor\yiisoft\yii2\console\controllers\BaseMigrateController.php(488): yii\db\Migration->up()
#5 C:\wamp\www\*****\vendor\yiisoft\yii2\console\controllers\BaseMigrateController.php(126): yii\console\controllers\BaseMigrateController->migrateUp('m000000_
000002_...')
#6 [internal function]: yii\console\controllers\BaseMigrateController->actionUp(0)
#7 C:\wamp\www\*****\vendor\yiisoft\yii2\base\InlineAction.php(55): call_user_func_array(Array, Array)
#8 C:\wamp\www\*****\vendor\yiisoft\yii2\base\Controller.php(151): yii\base\InlineAction->runWithParams(Array)
#9 C:\wamp\www\*****\vendor\yiisoft\yii2\console\Controller.php(91): yii\base\Controller->runAction('up', Array)
#10 C:\wamp\www\*****\vendor\yiisoft\yii2\base\Module.php(455): yii\console\Controller->runAction('up', Array)
#11 C:\wamp\www\*****\vendor\yiisoft\yii2\console\Application.php(161): yii\base\Module->runAction('migrate/up', Array)
#12 C:\wamp\www\*****\vendor\yiisoft\yii2\console\Application.php(137): yii\console\Application->runAction('migrate/up', Array)
#13 C:\wamp\www\*****\vendor\yiisoft\yii2\base\Application.php(375): yii\console\Application->handleRequest(Object(yii\console\Request))
#14 C:\wamp\www\*****\yii(31): yii\base\Application->run()#15 {main}
*** failed to apply m000000_000002_CreateUserTables (time: 0.016s)


Migration failed. The rest of the migrations are canceled

db配置正常/ config / main-local.php

我做错了什么? 谢谢

1 个答案:

答案 0 :(得分:1)

它尝试创建一个已存在于您的数据库(user表)中的表。因此,在创建user表时,迁移过程会卡住。从数据库中删除|重命名user表,然后再次执行安装。