Yii2.0 Advanced template Installation Minor issues

Source: Internet
Author: User

In the morning, the use of composer installed Yii2.0 advanced version, all configuration completed after the discovery of errors in the login, error shows no corresponding user table, and then to the official document on GitHub and looked again, found that the third step has not been implemented, do not know how to do this step, to seek guidance.

Reply content:

In the morning, the use of composer installed Yii2.0 advanced version, all configuration completed after the discovery of errors in the login, error shows no corresponding user table, and then to the official document on GitHub and looked again, found that the third step has not been implemented, do not know how to do this step, to seek guidance.

The third step is to perform a database migration operation, regarding migration-related documents

    1. You set up the database first.

    2. Configuring data information in common/config/main-local.php

    3. Yii is a PHP script that you can run with PHP yii migrate
      The migration script under the Console/migrations directory is executed, and the migration is just started. 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 ' = ' sche ' Ma::type_string. ' Not NULL ', ' auth_key ' = schema::type_string. ' (+) 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 ', ' created_at ' and ' = Schema::type_integer. ' Not NULL ', ' updated_at ' = Schema::type_integer.    ' Not NULL ',], $tableOptions);    The public function is down () {$this->droptable (' {{%user}} '); }}

Based on basic template guessing, you try to do this in the project directory:

./yii migrate

Open cmd, navigate to the project directory, type

yii migrate

If you re-install the YII2, you can directly copy the user table can be generated. The 3rd step is mainly to configure database tables, etc.

Yii Advanced Template Migrate

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.