|
| 1 | +<?php |
| 2 | +/** |
| 3 | + * Asset Packagist. |
| 4 | + * |
| 5 | + * @link https://github.com/hiqdev/asset-packagist |
| 6 | + * @package asset-packagist |
| 7 | + * @license BSD-3-Clause |
| 8 | + * @copyright Copyright (c) 2016-2017, HiQDev (http://hiqdev.com/) |
| 9 | + */ |
| 10 | + |
| 11 | +namespace hiqdev\assetpackagist\migrations; |
| 12 | + |
| 13 | +use yii\db\Migration; |
| 14 | + |
| 15 | +/** |
| 16 | + * Migration for queue message storage. |
| 17 | + * |
| 18 | + * @author Dmytro Naumenko <d.naumenko.a@gmail.com> |
| 19 | + */ |
| 20 | +class m170920_170000_queue_updated extends Migration |
| 21 | +{ |
| 22 | + public $tableName = '{{%queue}}'; |
| 23 | + |
| 24 | + public function up() |
| 25 | + { |
| 26 | + $this->dropTable($this->tableName); |
| 27 | + $this->createTable($this->tableName, [ |
| 28 | + 'id' => $this->primaryKey(), |
| 29 | + 'channel' => $this->string()->notNull(), |
| 30 | + 'job' => $this->binary()->notNull(), |
| 31 | + 'pushed_at' => $this->integer()->notNull(), |
| 32 | + 'ttr' => $this->integer()->notNull(), |
| 33 | + 'delay' => $this->integer()->notNull(), |
| 34 | + 'priority' => $this->integer()->unsigned()->notNull()->defaultValue(1024), |
| 35 | + 'reserved_at' => $this->integer(), |
| 36 | + 'attempt' => $this->integer(), |
| 37 | + 'done_at' => $this->integer(), |
| 38 | + ]); |
| 39 | + $this->createIndex('channel', $this->tableName, 'channel'); |
| 40 | + $this->createIndex('reserved_at', $this->tableName, 'reserved_at'); |
| 41 | + $this->createIndex('priority', $this->tableName, 'priority'); |
| 42 | + } |
| 43 | + |
| 44 | + public function down() |
| 45 | + { |
| 46 | + $this->dropTable($this->tableName); |
| 47 | + $this->createTable($this->tableName, [ |
| 48 | + 'id' => $this->primaryKey(), |
| 49 | + 'channel' => $this->string()->notNull(), |
| 50 | + 'job' => $this->binary()->notNull(), |
| 51 | + 'created_at' => $this->integer()->notNull(), |
| 52 | + 'started_at' => $this->integer(), |
| 53 | + 'finished_at' => $this->integer(), |
| 54 | + ]); |
| 55 | + $this->createIndex('channel', $this->tableName, 'channel'); |
| 56 | + $this->createIndex('started_at', $this->tableName, 'started_at'); |
| 57 | + } |
| 58 | +} |
0 commit comments