m210607_123711_add_host_tix_date_status.php 983 Bytes
<?php

use yii\db\Migration;

/**
 * Class m210607_123711_add_host_tix_date_status
 */
class m210607_123711_add_host_tix_date_status extends Migration
{
    /**
     * {@inheritdoc}
     */
    public function safeUp()
    {
        $this->addColumn('{{%host}}', 'tix_status', $this->tinyInteger(1)->notNull()->defaultValue(0)->comment('Статус проверки стоимости'));
        $this->addColumn('{{%host}}', 'tix_date', $this->dateTime()->null()->comment('Дата проверки стоимости домена'));

        $this->createIndex('idx-tix_status', '{{%host}}', 'tix_status');
        $this->createIndex('idx-status', '{{%host}}', 'status');
    }

    /**
     * {@inheritdoc}
     */
    public function safeDown()
    {
        $this->dropIndex('idx-status', '{{%host}}');
        $this->dropIndex('idx-tix_status', '{{%host}}');

        $this->dropColumn('{{%host}}', 'tix_date');
        $this->dropColumn('{{%host}}', 'tix_status');
    }
}