Commit 404700e6 authored by Shakarim Sapa's avatar Shakarim Sapa

- Правки по рассылкам по кейсам

parent 301af5eb
...@@ -15,6 +15,7 @@ use common\modules\messageTemplate\models\MessageTemplate; ...@@ -15,6 +15,7 @@ use common\modules\messageTemplate\models\MessageTemplate;
* @property integer $case_id * @property integer $case_id
* @property integer $template_id * @property integer $template_id
* @property string $sended_date * @property string $sended_date
* @property string $email
* @property integer $sended * @property integer $sended
* @property integer $actual * @property integer $actual
* *
...@@ -38,12 +39,13 @@ class CasesSchedule extends \yii\db\ActiveRecord ...@@ -38,12 +39,13 @@ class CasesSchedule extends \yii\db\ActiveRecord
public function rules() public function rules()
{ {
return [ return [
[['user_id', 'case_id'], 'required'], [['case_id'], 'required'],
[['email'], 'string'],
[['user_id', 'case_id', 'template_id', 'sended', 'actual'], 'integer'], [['user_id', 'case_id', 'template_id', 'sended', 'actual'], 'integer'],
[['sended_date'], 'safe'], [['sended_date'], 'safe'],
[['template_id'], 'exist', 'skipOnError' => true, 'targetClass' => MessageTemplate::className(), 'targetAttribute' => ['template_id' => 'id']], [['template_id'], 'exist', 'skipOnError' => true, 'targetClass' => MessageTemplate::className(), 'targetAttribute' => ['template_id' => 'id']],
[['case_id'], 'exist', 'skipOnError' => true, 'targetClass' => CoContent::className(), 'targetAttribute' => ['case_id' => 'id']], [['case_id'], 'exist', 'skipOnError' => true, 'targetClass' => CoContent::className(), 'targetAttribute' => ['case_id' => 'id']],
[['user_id'], 'exist', 'skipOnError' => true, 'targetClass' => User::className(), 'targetAttribute' => ['user_id' => 'id']], [['user_id'], 'exist', 'skipOnError' => false, 'targetClass' => User::className(), 'targetAttribute' => ['user_id' => 'id']],
]; ];
} }
...@@ -55,6 +57,7 @@ class CasesSchedule extends \yii\db\ActiveRecord ...@@ -55,6 +57,7 @@ class CasesSchedule extends \yii\db\ActiveRecord
return [ return [
'id' => 'ID', 'id' => 'ID',
'user_id' => 'Пользователь', 'user_id' => 'Пользователь',
'email' => 'E-mail',
'case_id' => 'Кейс', 'case_id' => 'Кейс',
'template_id' => 'Шаблон', 'template_id' => 'Шаблон',
'sended_date' => 'Дата отправки', 'sended_date' => 'Дата отправки',
......
<?php
use yii\db\Migration;
class m160512_151201_update_the_cases_schedule_table extends Migration
{
// Use safeUp/safeDown to run migration code within a transaction
public function safeUp()
{
$this->dropForeignKey(
'fk_cases_schedule_user',
'cases_schedule'
);
$this->alterColumn(
'cases_schedule',
'user_id',
$this->integer(11)->defaultValue(null)
);
$this->addForeignKey(
'fk_cases_schedule_user',
'cases_schedule', 'user_id',
'users', 'id'
);
$this->addColumn(
'cases_schedule',
'email',
'varchar(255) NOT NULL'
);
}
public function safeDown()
{
$this->dropForeignKey(
'fk_cases_schedule_user',
'cases_schedule'
);
$this->alterColumn(
'cases_schedule',
'user_id',
$this->integer(11)->notNull()
);
$this->addForeignKey(
'fk_cases_schedule_user',
'cases_schedule', 'user_id',
'users', 'id'
);
$this->dropColumn(
'cases_schedule',
'email'
);
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment