Skip to content

Commit 5234df9

Browse files
author
igor-chepurnoi
committed
update init migration
1 parent 40561d6 commit 5234df9

File tree

6 files changed

+24
-31
lines changed

6 files changed

+24
-31
lines changed

actions/CronLogAction.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,4 @@ public function run()
3434
'dataProvider' => $dataProvider
3535
]);
3636
}
37-
38-
}
37+
}

behaviors/CronLoggerBehavior.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,4 +124,4 @@ private function getActionParams()
124124

125125
return $result;
126126
}
127-
}
127+
}

behaviors/MutexConsoleCommandBehavior.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
use yii\console\Controller;
88
use yii\mutex\Mutex;
99

10-
1110
/**
1211
* MutexConsoleCommandBehavior allows console command actions being run with mutex protection.
1312
*
@@ -36,12 +35,12 @@ class MutexConsoleCommandBehavior extends Behavior
3635
* @var string name of the mutex application component.
3736
*/
3837
public $mutex = 'mutex';
38+
3939
/**
4040
* @var array list of action names, which mutex should be applied to.
4141
*/
4242
public $mutexActions = [];
4343

44-
4544
/**
4645
* @inheritdoc
4746
*/
@@ -85,7 +84,6 @@ public function checkIsMutexAction($action)
8584
return in_array(strtolower($action), $this->mutexActions) || in_array('*', $this->mutexActions);
8685
}
8786

88-
8987
/**
9088
* @param $event
9189
* @return bool
@@ -102,7 +100,6 @@ public function beforeAction($event)
102100
}
103101
}
104102

105-
106103
/**
107104
* @param $event
108105
*/
@@ -113,4 +110,4 @@ public function afterAction($event)
113110
$this->getMutex()->release($mutexName);
114111
}
115112
}
116-
}
113+
}

components/ErrorHandler.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace yii2mod\cron\components;
44

5-
use Yii;
65
use yii\web\HttpException;
76
use yii2mod\cron\models\CronScheduleModel;
87
use yii2mod\cron\models\enumerables\CronScheduleStatus;
@@ -37,5 +36,4 @@ public function logException($exception)
3736
}
3837
\Yii::error((string)$exception, $category);
3938
}
40-
41-
}
39+
}

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "yii2mod/yii2-cron-log",
33
"description": "Component for logging cron jobs",
44
"type": "yii2-extension",
5-
"keywords": ["yii2", "extension"],
5+
"keywords": ["yii2 cron log", "cron log", "logging cron jobs"],
66
"license": "MIT",
77
"authors": [
88
{
@@ -15,7 +15,7 @@
1515
}
1616
],
1717
"require": {
18-
"yiisoft/yii2": "*",
18+
"yiisoft/yii2": ">=2.0.8",
1919
"yii2mod/yii2-enum": ">=1.1"
2020
},
2121
"autoload": {
Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,37 @@
11
<?php
22

3-
use yii\db\Schema;
43
use yii\db\Migration;
54

5+
/**
6+
* Class m150105_172247_create_cron_schedule_tbl
7+
*/
68
class m150105_172247_create_cron_schedule_tbl extends Migration
79
{
810
public function safeUp()
911
{
1012
$tableOptions = null;
13+
1114
if ($this->db->driverName === 'mysql') {
1215
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB';
1316
}
1417

15-
$this->createTable(
16-
'{{%CronSchedule}}',
17-
[
18-
'id' => Schema::TYPE_PK,
19-
'jobCode' => Schema::TYPE_STRING . '(255) NULL DEFAULT NULL',
20-
'status' => Schema::TYPE_SMALLINT . ' NOT NULL',
21-
'messages' => Schema::TYPE_TEXT . ' NULL',
22-
'dateCreated' => Schema::TYPE_TIMESTAMP . ' NULL DEFAULT NULL',
23-
'dateScheduled' => Schema::TYPE_TIMESTAMP . ' NULL DEFAULT NULL',
24-
'dateExecuted' => Schema::TYPE_TIMESTAMP . ' NULL DEFAULT NULL',
25-
'dateFinished' => Schema::TYPE_TIMESTAMP . ' NULL DEFAULT NULL',
26-
],
27-
$tableOptions
28-
);
18+
$this->createTable('{{%CronSchedule}}', [
19+
'id' => $this->primaryKey(),
20+
'jobCode' => $this->string()->null(),
21+
'status' => $this->smallInteger()->notNull(),
22+
'messages' => $this->text(),
23+
'dateCreated' => $this->timestamp()->null(),
24+
'dateScheduled' => $this->timestamp()->null(),
25+
'dateExecuted' => $this->timestamp()->null(),
26+
'dateFinished' => $this->timestamp()->null(),
27+
], $tableOptions);
2928

30-
$this->createIndex('IDX_CRON_SCHEDULE_JOB_CODE', '{{%CronSchedule}}', ['jobCode']);
31-
$this->createIndex('IDX_CRON_SCHEDULE_SCHEDULED_AT_STATUS', '{{%CronSchedule}}', ['dateScheduled', 'status']);
29+
$this->createIndex('idx-CronSchedule-jobCode', '{{%CronSchedule}}', ['jobCode']);
30+
$this->createIndex('idx-CronSchedule-dateScheduled-status', '{{%CronSchedule}}', ['dateScheduled', 'status']);
3231
}
3332

3433
public function safeDown()
3534
{
3635
$this->dropTable('{{%CronSchedule}}');
3736
}
38-
}
37+
}

0 commit comments

Comments
 (0)