26656179
Administrator
01.03.16
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
<?php
use yii\db\Migration;
class m160301_105759_chat extends Migration
{
public function up()
{
$this->createTable('{{%chat}}', [
'chat_id' => $this->primaryKey(),
'status' => $this->string(),
'comment' => $this->string(),
'from_user' => $this->integer(),
'to_user' => $this->integer(),
]);
$this->addForeignKey('chat_from_user', '{{%chat}}', 'from_user', '{{%user}}', 'id', 'SET NULL', 'NO ACTION');
$this->addForeignKey('chat_to_user', '{{%chat}}', 'to_user', '{{%user}}', 'id', 'SET NULL', 'NO ACTION');
}
public function down()
{
$this->dropForeignKey('chat_from_user', '{{%chat}}');
$this->dropForeignKey('chat_to_user', '{{%chat}}');
$this->dropTable('{{%chat}}');
}
}
|