You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
1.4 KiB

  1. <?php
  2. use yii\db\Migration;
  3. /**
  4. * Class m191111_112559_create_table_address
  5. */
  6. class m191111_112559_create_table_address extends Migration
  7. {
  8. /**
  9. * {@inheritdoc}
  10. */
  11. public function up()
  12. {
  13. $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB COMMENT="地址表"';
  14. $this->createTable('ats_address', [
  15. 'id' => $this->primaryKey(),
  16. 'user_id'=>$this->integer(11)->notNull()->comment('用户id'),
  17. 'consignee'=>$this->string(20)->notNull()->comment('收件人'),
  18. 'phone'=>$this->string(20)->notNull()->comment('电话'),
  19. 'province'=>$this->string(10)->defaultValue(null)->comment('省份'),
  20. 'city'=>$this->string(10)->defaultValue(null)->comment('城市'),
  21. 'area'=>$this->string(10)->defaultValue(null)->comment('区域'),
  22. 'address'=>$this->text()->notNull()->comment('详细地址'),
  23. 'status'=>$this->tinyInteger(1)->defaultValue(0)->comment('状态,0-默认值 1-默认地址'),
  24. 'created_at'=>$this->integer(11)->defaultValue(null)->comment('创建时间'),
  25. 'updated_at'=>$this->integer(11)->defaultValue(null)->comment('更新时间'),
  26. ],$tableOptions);
  27. }
  28. /**
  29. * {@inheritdoc}
  30. */
  31. public function down()
  32. {
  33. $this->dropTable('ats_address');
  34. return true;
  35. }
  36. }