M250819013911CreateQimallAddonsShortVideoUserWatch.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. namespace addons\ShortVideo\console\migrations;
  3. use yii\db\Migration;
  4. /**
  5. * Class M250819013911CreateQimallAddonsShortVideoUserWatch
  6. */
  7. class M250819013911CreateQimallAddonsShortVideoUserWatch extends Migration
  8. {
  9. /**
  10. * {@inheritdoc}
  11. */
  12. public function safeUp()
  13. {
  14. $sql = "CREATE TABLE `qimall_addons_short_video_user_watch` (
  15. `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
  16. `mall_id` int(11) NOT NULL COMMENT '商城id',
  17. `user_id` int(11) NOT NULL COMMENT '用户id',
  18. `video_id` int(11) NOT NULL COMMENT '视频id',
  19. `status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '状态(0:未观看,1:已观看)',
  20. `created_at` int(11) DEFAULT NULL COMMENT '添加时间',
  21. `updated_at` int(11) DEFAULT NULL COMMENT '修改时间',
  22. PRIMARY KEY (`id`)
  23. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;";
  24. $this->execute($sql);
  25. }
  26. /**
  27. * {@inheritdoc}
  28. */
  29. public function safeDown()
  30. {
  31. echo "M250819013911CreateQimallAddonsShortVideoUserWatch 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 "M250819013911CreateQimallAddonsShortVideoUserWatch cannot be reverted.\n";
  42. return false;
  43. }
  44. */
  45. }