M230815084627SmartFormAddUserFormIdIndex.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. namespace addons\SmartForm\console\migrations;
  3. use yii\db\Migration;
  4. /**
  5. * Class M230815084627SmartFormAddUserFormIdIndex
  6. */
  7. class M230815084627SmartFormAddUserFormIdIndex extends Migration
  8. {
  9. /**
  10. * {@inheritdoc}
  11. */
  12. public function safeUp()
  13. {
  14. $this->execute("ALTER TABLE `qimall_addons_smart_form_sms_notice` ADD INDEX `user_form_id` (`user_form_id`);");
  15. $this->execute("ALTER TABLE `qimall_addons_smart_form_template_user_form` ADD COLUMN `is_ignore` TINYINT(1) UNSIGNED NOT NULL DEFAULT '0' COMMENT '是否忽略、忽略后可再次填写当前表单' AFTER `status`;");
  16. $this->execute("ALTER TABLE `qimall_addons_smart_form_template_user_form` ADD COLUMN `order_id` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '绑定所属订单' AFTER `is_ignore`, ADD INDEX `order_id` (`order_id`);");
  17. }
  18. /**
  19. * {@inheritdoc}
  20. */
  21. public function safeDown()
  22. {
  23. echo "M230815084627SmartFormAddUserFormIdIndex cannot be reverted.\n";
  24. return false;
  25. }
  26. /*
  27. // Use up()/down() to run migration code without a transaction.
  28. public function up()
  29. {
  30. }
  31. public function down()
  32. {
  33. echo "M230815084627SmartFormAddUserFormIdIndex cannot be reverted.\n";
  34. return false;
  35. }
  36. */
  37. }