| 123456789101112131415161718192021222324252627282930313233343536373839404142434445 | 
							- <?php
 
- use yii\db\Migration;
 
- use yii\db\Schema;
 
- /**
 
-  * Handles the creation of table `{{%address}}`.
 
-  */
 
- class m190203_071900_create_address_table extends Migration
 
- {
 
-     public $tableOptions = 'CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE=InnoDB';
 
-     /**
 
-      * @inheritdoc
 
-      */
 
-     public function up()
 
-     {
 
-         /**
 
-          * 收货人姓名、电话、省、市、区、详细地址、是否默认、用户id
 
-          */
 
-         $this->createTable('{{%address}}', [
 
-             'id' => Schema::TYPE_PK,
 
-             'user_id' => $this->integer(11)->notNull()->comment('用户ID'),
 
-             'name' => Schema::TYPE_STRING . "(20) NOT NULL COMMENT '收货人'",
 
-             'tel' => Schema::TYPE_STRING . "(11) NOT NULL COMMENT '手机号'",
 
-             'province' => Schema::TYPE_STRING . "(50) NOT NULL  COMMENT '省份'",
 
-             'city' => Schema::TYPE_STRING . "(50) NOT NULL  COMMENT '城市'",
 
-             'area' => Schema::TYPE_STRING . "(50) NOT NULL  COMMENT '区域'",
 
-             'detail' => Schema::TYPE_STRING . "(200) NOT NULL  COMMENT '详细地址'",
 
-             'created_at' => Schema::TYPE_INTEGER . "(11) NOT NULL",
 
-             'updated_at' => Schema::TYPE_INTEGER . "(11) NOT NULL",
 
-             'status' => Schema::TYPE_SMALLINT . "(1) NOT NULL DEFAULT '1' COMMENT '状态'",
 
-         ], $this->tableOptions);
 
-     }
 
-     /**
 
-      * @inheritdoc
 
-      */
 
-     public function down()
 
-     {
 
-         $this->dropTable('{{%address}}');
 
-     }
 
- }
 
 
  |