In the morning, the advanced version of Yii2.0 is installed using Composer. After all the configurations are completed, an error is found at the logon location. The error message shows that no corresponding user table exists, then I read it again against the official documentation on Github and found that the third step was not executed. I don't know how to do this step.
In the morning, the advanced version of Yii2.0 is installed using Composer. After all the configurations are completed, an error is found at the logon location. The error message shows that no corresponding user table exists, then I read it again against the official documentation on Github and found that the third step was not executed. I don't know how to do this step.
Reply content:
In the morning, the advanced version of Yii2.0 is installed using Composer. After all the configurations are completed, an error is found at the logon location. The error message shows that no corresponding user table exists, then I read it again against the official documentation on Github and found that the third step was not executed. I don't know how to do this step.
Step 3: perform database migration operations. Migration-related documents
You should first establish a database
Configure data information in the common/config/main-local.php
Yii is a php script. You can run php yii migrate.
Execute the migration script under the console/migrations directory. At the beginning of the migration, a user table is created.
The migration script content is as follows:
db->driverName === 'mysql') { // http://stackoverflow.com/questions/766809/whats-the-difference-between-utf8-general-ci-and-utf8-unicode-ci $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB'; } $this->createTable('{{%user}}', [ 'id' => Schema::TYPE_PK, 'username' => Schema::TYPE_STRING . ' NOT NULL', 'auth_key' => Schema::TYPE_STRING . '(32) NOT NULL', 'password_hash' => Schema::TYPE_STRING . ' NOT NULL', 'password_reset_token' => Schema::TYPE_STRING, 'email' => Schema::TYPE_STRING . ' NOT NULL', 'status' => Schema::TYPE_SMALLINT . ' NOT NULL DEFAULT 10', 'created_at' => Schema::TYPE_INTEGER . ' NOT NULL', 'updated_at' => Schema::TYPE_INTEGER . ' NOT NULL', ], $tableOptions); } public function down() { $this->dropTable('{{%user}}'); }}
Based on the basic template, you can try to run the following command in the project directory:
./yii migrate
Open cmd, go to the project directory, and type
yii migrate
If you reinstall YII2, you can directly copy and generate the user table. Step 1 mainly refers to configuring database tables.
Yii advanced template Migrate