<?php

namespace onespace\tools\rabbit\migrations;

use yii\db\Migration;

class m250827_123100_add_transaction_catch_log extends Migration {
    /**
     * {@inheritdoc}
     */
    public function safeUp() {
        $this->createTable(
            '{{%rabbit_transaction_error_log}}',
            [
                'id' => $this->primaryKey(),
                'worker_class' => $this->string(200),
                'message_body' => $this->string(),
                'message_headers' => $this->string(),
                'routing_key' => $this->string(),
                'date_created' => $this->dateTime()->notNull(),
            ]
        );
    }

    /**
     * {@inheritdoc}
     */
    public function safeDown() {
        $this->dropTable('{{%rabbit_transaction_error_log}}');
    }

    /*
    // Use up()/down() to run migration code without a transaction.
    public function up()
    {

    }

    public function down()
    {
        echo "m250514_080110_increate_ttl_rabbit_outbox cannot be reverted.\n";

        return false;
    }
    */
}
