m200109_135436_turbo.php 910 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. use yii\db\Migration;
  3. /**
  4. * Class m200109_135436_turbo
  5. */
  6. class m200109_135436_turbo extends Migration
  7. {
  8. /**
  9. * {@inheritdoc}
  10. */
  11. public function safeUp()
  12. {
  13. if (class_exists('\wdmg\pages\models\Pages')) {
  14. $userTable = \wdmg\pages\models\Pages::tableName();
  15. if (is_null($this->getDb()->getSchema()->getTableSchema($userTable)->getColumn('in_turbo')))
  16. $this->addColumn($userTable, 'in_turbo', $this->boolean()->defaultValue(true));
  17. }
  18. }
  19. /**
  20. * {@inheritdoc}
  21. */
  22. public function safeDown()
  23. {
  24. if (class_exists('\wdmg\pages\models\Pages')) {
  25. $userTable = \wdmg\pages\models\Pages::tableName();
  26. if (!is_null($this->getDb()->getSchema()->getTableSchema($userTable)->getColumn('in_turbo')))
  27. $this->dropColumn($userTable, 'in_turbo');
  28. }
  29. }
  30. }