These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
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 Roman Zhuravlev <[email protected]> |
||
19 | */ |
||
20 | class m161129_140000_queue extends Migration |
||
21 | { |
||
22 | public $tableName = '{{%queue}}'; |
||
23 | public $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB'; |
||
24 | |||
25 | View Code Duplication | public function up() |
|
0 ignored issues
–
show
|
|||
26 | { |
||
27 | $this->createTable($this->tableName, [ |
||
28 | 'id' => $this->primaryKey(), |
||
29 | 'channel' => $this->string()->notNull(), |
||
30 | 'job' => $this->binary()->notNull(), |
||
31 | 'created_at' => $this->integer()->notNull(), |
||
32 | 'started_at' => $this->integer(), |
||
33 | 'finished_at' => $this->integer(), |
||
34 | ], $this->tableOptions); |
||
35 | |||
36 | $this->createIndex('channel', $this->tableName, 'channel'); |
||
37 | $this->createIndex('started_at', $this->tableName, 'started_at'); |
||
38 | } |
||
39 | |||
40 | public function down() |
||
41 | { |
||
42 | $this->dropTable($this->tableName); |
||
43 | } |
||
44 | } |
||
45 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.