M230217183124CreateChainGoodsPicTable.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. namespace app\migrations;
  3. use yii\db\Migration;
  4. /**
  5. * Class M230217183124CreateChainGoodsPicTable
  6. */
  7. class M230217183124CreateChainGoodsPicTable extends Migration
  8. {
  9. /**
  10. * {@inheritdoc}
  11. */
  12. public function safeUp()
  13. {
  14. $log_sql = "CREATE TABLE `qimall_supply_chain_goods_pic` (
  15. `id` int(10) NOT NULL AUTO_INCREMENT,
  16. `mall_id` int(10) NOT NULL COMMENT '商城ID',
  17. `goods_id` int(10) NOT NULL COMMENT '商品ID',
  18. `chain_url` varchar(255) NOT NULL COMMENT '供应链商品主图',
  19. `url` varchar(255) NOT NULL COMMENT '商品主图',
  20. `updated_at` int(10) DEFAULT NULL,
  21. `created_at` int(10) DEFAULT NULL,
  22. PRIMARY KEY (`id`)
  23. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;";
  24. $this->execute($log_sql);
  25. }
  26. /**
  27. * {@inheritdoc}
  28. */
  29. public function safeDown()
  30. {
  31. echo "M230217183124CreateChainGoodsPicTable cannot be reverted.\n";
  32. return false;
  33. }
  34. /*
  35. // Use up()/down() to run migration code without a transaction.
  36. public function up()
  37. {
  38. }
  39. public function down()
  40. {
  41. echo "M230217183124CreateChainGoodsPicTable cannot be reverted.\n";
  42. return false;
  43. }
  44. */
  45. }