-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathm200821_144606_deal_notes.php
52 lines (43 loc) · 1.09 KB
/
m200821_144606_deal_notes.php
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
use yii\db\Expression;
use yii\db\Migration;
/**
* Class m200821_144606_deal_notes
*/
class m200821_144606_deal_notes extends Migration
{
/**
* {@inheritdoc}
*/
public function up()
{
$this->createTable('note', [
'id' => $this->primaryKey(),
'deal_id' => $this->integer()->notNull(),
'dt_add' => $this->dateTime()->defaultValue(new Expression('NOW()')),
'user_id' => $this->integer()->notNull(),
'content' => $this->text()
]);
$this->addForeignKey('user_note', 'note', 'user_id', 'user', 'id');
$this->addForeignKey('deal_note', 'note', 'deal_id', 'deal', 'id');
}
/**
* {@inheritdoc}
*/
public function safeDown()
{
echo "m200821_144606_deal_notes cannot be reverted.\n";
return false;
}
/*
// Use up()/down() to run migration code without a transaction.
public function up()
{
}
public function down()
{
echo "m200821_144606_deal_notes cannot be reverted.\n";
return false;
}
*/
}