Skip to content

Commit

Permalink
Added migration to follow yii2-queue API changes
Browse files Browse the repository at this point in the history
  • Loading branch information
SilverFire committed Sep 21, 2017
1 parent 052b795 commit 9b7d7ff
Showing 1 changed file with 58 additions and 0 deletions.
58 changes: 58 additions & 0 deletions src/migrations/m170920_170000_queue_updated.php
@@ -0,0 +1,58 @@
<?php
/**
* Asset Packagist.
*
* @link https://github.com/hiqdev/asset-packagist
* @package asset-packagist
* @license BSD-3-Clause
* @copyright Copyright (c) 2016-2017, HiQDev (http://hiqdev.com/)
*/

namespace hiqdev\assetpackagist\migrations;

use yii\db\Migration;

/**
* Migration for queue message storage.
*
* @author Dmytro Naumenko <d.naumenko.a@gmail.com>
*/
class m170920_170000_queue_updated extends Migration
{
public $tableName = '{{%queue}}';

public function up()
{
$this->dropTable($this->tableName);
$this->createTable($this->tableName, [
'id' => $this->primaryKey(),
'channel' => $this->string()->notNull(),
'job' => $this->binary()->notNull(),
'pushed_at' => $this->integer()->notNull(),
'ttr' => $this->integer()->notNull(),
'delay' => $this->integer()->notNull(),
'priority' => $this->integer()->unsigned()->notNull()->defaultValue(1024),
'reserved_at' => $this->integer(),
'attempt' => $this->integer(),
'done_at' => $this->integer(),
]);
$this->createIndex('channel', $this->tableName, 'channel');
$this->createIndex('reserved_at', $this->tableName, 'reserved_at');
$this->createIndex('priority', $this->tableName, 'priority');
}

public function down()
{
$this->dropTable($this->tableName);
$this->createTable($this->tableName, [
'id' => $this->primaryKey(),
'channel' => $this->string()->notNull(),
'job' => $this->binary()->notNull(),
'created_at' => $this->integer()->notNull(),
'started_at' => $this->integer(),
'finished_at' => $this->integer(),
]);
$this->createIndex('channel', $this->tableName, 'channel');
$this->createIndex('started_at', $this->tableName, 'started_at');
}
}

0 comments on commit 9b7d7ff

Please sign in to comment.