Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added migration to follow yii2-queue API changes
- Loading branch information
1 parent
052b795
commit 9b7d7ff
Showing
1 changed file
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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'); | ||
} | ||
} |