m221225_045621_slider.php 904 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. use yii\db\Migration;
  3. /**
  4. * Class m221225_045621_slider
  5. */
  6. class m221225_045621_slider extends Migration
  7. {
  8. /**
  9. * {@inheritdoc}
  10. */
  11. public function safeUp()
  12. {
  13. $this->createTable('{{%top_slider}}',[
  14. 'id'=>$this->primaryKey(),
  15. 'post_id'=>$this->integer(),
  16. 'published_from'=>$this->dateTime(),
  17. 'published_to'=>$this->dateTime(),
  18. 'is_active'=>$this->smallInteger()->defaultValue(1)
  19. ]);
  20. }
  21. /**
  22. * {@inheritdoc}
  23. */
  24. public function safeDown()
  25. {
  26. echo "m221225_045621_slider 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 "m221225_045621_slider cannot be reverted.\n";
  37. return false;
  38. }
  39. */
  40. }