M240704091330AttachmentTableAddStoreIdField.php 816 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. namespace app\migrations;
  3. use yii\db\Migration;
  4. /**
  5. * Class M240704091330AttachmentTableAddStoreIdField
  6. */
  7. class M240704091330AttachmentTableAddStoreIdField extends Migration
  8. {
  9. /**
  10. * {@inheritdoc}
  11. */
  12. public function safeUp()
  13. {
  14. $sql = <<<SQL
  15. ALTER TABLE `qimall_attachment`
  16. ADD COLUMN `store_id` int UNSIGNED NOT NULL DEFAULT 0 COMMENT '门店ID' AFTER `mch_id`;
  17. SQL;
  18. $this->execute($sql);
  19. }
  20. /**
  21. * {@inheritdoc}
  22. */
  23. public function safeDown()
  24. {
  25. return false;
  26. }
  27. /*
  28. // Use up()/down() to run migration code without a transaction.
  29. public function up()
  30. {
  31. }
  32. public function down()
  33. {
  34. echo "M240704091330AttachmentTableAddStoreIdField cannot be reverted.\n";
  35. return false;
  36. }
  37. */
  38. }