2261f70a
Yarik
test
|
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
|
<?php
use yii\db\Migration;
class m160314_090858_project_comment extends Migration
{
public function up()
{
$this->createTable('{{%comment_project}}', [
'comment_id' => $this->primaryKey(),
'model' => $this->string()->notNull(),
'model_id' => $this->integer()->notNull(),
'text' => $this->text()->notNull(),
'files' => $this->string(),
'budget_from' => $this->float()->notNull()->defaultValue(0),
'budget_to' => $this->float()->notNull()->defaultValue(0),
'budget_currency' => $this->integer()->notNull()->defaultValue(3),
'term_from' => $this->integer()->notNull()->defaultValue(0),
'term_to' => $this->integer()->notNull()->defaultValue(0),
'user_id' => $this->integer()->notNull(),
'status' => $this->integer(),
'date_add' => $this->timestamp()->notNull()->defaultExpression('NOW()'),
'date_update' => $this->timestamp()->notNull()->defaultExpression('NOW()'),
'date_delete' => $this->timestamp(),
]);
$this->addForeignKey('comment_project_user', '{{%comment_project}}', 'user_id', '{{%user}}', 'id', 'CASCADE', 'CASCADE');
}
public function down()
{
$this->dropForeignKey('comment_project_user', '{{%comment_project}}');
$this->dropTable('{{%comment_project}}');
}
}
|