m220929_071856_add_image_to_topic.php 911 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. use yii\db\Migration;
  3. /**
  4. * Class m220929_071856_add_image_to_topic
  5. */
  6. class m220929_071856_add_image_to_topic extends Migration
  7. {
  8. /**
  9. * {@inheritdoc}
  10. */
  11. public function safeUp()
  12. {
  13. $this->createTable("{{%topic_images}}",[
  14. "id"=>$this->primaryKey(),
  15. "topic_id"=>$this->integer(),
  16. "uploaded_at"=>$this->dateTime(),
  17. "alt"=>$this->text(),
  18. "ext"=>$this->string(),
  19. ]);
  20. }
  21. /**
  22. * {@inheritdoc}
  23. */
  24. public function safeDown()
  25. {
  26. echo "m220929_071856_add_image_to_topic cannot be reverted.\n";
  27. return false;
  28. }
  29. /*
  30. // Use up()/down() to run migration code without a transaction.
  31. public function up()
  32. {
  33. }
  34. public function down()
  35. {
  36. echo "m220929_071856_add_image_to_topic cannot be reverted.\n";
  37. return false;
  38. }
  39. */
  40. }