m181111_140802_create_package_table.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. use yii\db\Migration;
  3. use yii\db\Schema;
  4. /**
  5. * Handles the creation of table `{{%package}}`.
  6. */
  7. class m181111_140802_create_package_table extends Migration
  8. {
  9. public $tableOptions = 'CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE=InnoDB';
  10. /**
  11. * @inheritdoc
  12. */
  13. public function up()
  14. {
  15. $this->createTable('{{%package}}', [
  16. 'id' => Schema::TYPE_PK,
  17. 'order_id' => Schema::TYPE_INTEGER . "(11) NOT NULL COMMENT '订单ID'",
  18. 'order_sku_ids' => Schema::TYPE_INTEGER . "(11) NOT NULL COMMENT '订单商品ID组'",
  19. 'no' => Schema::TYPE_STRING . "(32) NOT NULL COMMENT '物流单号'",
  20. 'com' => Schema::TYPE_STRING. "(20) NULL COMMENT '物流公司'",
  21. 'created_at' => Schema::TYPE_INTEGER . "(11) NOT NULL",
  22. 'updated_at' => Schema::TYPE_INTEGER . "(11) NOT NULL",
  23. 'status' => Schema::TYPE_SMALLINT . "(1) NOT NULL DEFAULT '1' COMMENT '状态'",
  24. ]);
  25. }
  26. /**
  27. * @inheritdoc
  28. */
  29. public function down()
  30. {
  31. $this->dropTable('{{%package}}');
  32. }
  33. }