d8c1a2e0
Yarik
Big commit artbox
|
1
|
<?php
|
d8c1a2e0
Yarik
Big commit artbox
|
2
|
|
5c2eb7c8
Yarik
Big commit almost...
|
3
|
use yii\db\Migration;
|
d8c1a2e0
Yarik
Big commit artbox
|
4
|
|
5c2eb7c8
Yarik
Big commit almost...
|
5
|
class m160724_162347_artbox_comment extends Migration
|
d8c1a2e0
Yarik
Big commit artbox
|
6
|
{
|
5c2eb7c8
Yarik
Big commit almost...
|
7
8
9
|
public function up()
{
|
8af13427
Yarik
For leha commit.
|
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
$this->createTable(
'{{%artbox_comment}}',
[
'artbox_comment_id' => $this->primaryKey(),
'text' => $this->text()
->notNull(),
'user_id' => $this->integer(),
'username' => $this->string(),
'email' => $this->string(),
'created_at' => $this->integer()
->notNull(),
'updated_at' => $this->integer()
->notNull(),
'deleted_at' => $this->integer(),
'status' => $this->integer()
->notNull()
->defaultValue(1),
'artbox_comment_pid' => $this->integer(),
'related_id' => $this->integer(),
'ip' => $this->string()
->notNull(),
'info' => $this->text(),
]
);
|
5c2eb7c8
Yarik
Big commit almost...
|
34
|
|
8af13427
Yarik
For leha commit.
|
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
$this->addForeignKey(
'user_id_user',
'{{%artbox_comment}}',
'user_id',
'customer',
'id',
'CASCADE',
'CASCADE'
);
$this->addForeignKey(
'artbox_comment_pid_artbox_comment',
'{{%artbox_comment}}',
'artbox_comment_pid',
'artbox_comment',
'artbox_comment_id',
'CASCADE',
'CASCADE'
);
$this->addForeignKey(
'related_id_artbox_comment',
'{{%artbox_comment}}',
'related_id',
'artbox_comment',
'artbox_comment_id',
'CASCADE',
'CASCADE'
);
|
5c2eb7c8
Yarik
Big commit almost...
|
62
|
|
8af13427
Yarik
For leha commit.
|
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
$this->createTable(
'{{%artbox_like}}',
[
'artbox_like_id' => $this->primaryKey(),
'artbox_comment_id' => $this->integer()
->notNull(),
'user_id' => $this->integer(),
'created_at' => $this->integer()
->notNull(),
'is_like' => $this->integer()
->notNull()
->defaultValue(1),
]
);
|
5c2eb7c8
Yarik
Big commit almost...
|
77
|
|
8af13427
Yarik
For leha commit.
|
78
79
80
|
$this->addForeignKey(
'artbox_comment_id_artbox_comment',
'{{%artbox_like}}',
|
5c2eb7c8
Yarik
Big commit almost...
|
81
|
'artbox_comment_id',
|
8af13427
Yarik
For leha commit.
|
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
'artbox_comment',
'artbox_comment_id',
'CASCADE',
'CASCADE'
);
$this->addForeignKey('user_id_user', '{{%artbox_like}}', 'user_id', 'customer', 'id', 'CASCADE', 'CASCADE');
$this->createIndex(
'artbox_like_unique',
'{{%artbox_like}}',
[
'artbox_comment_id',
'user_id',
'is_like',
],
true
);
|
5c2eb7c8
Yarik
Big commit almost...
|
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
}
public function down()
{
$this->dropForeignKey('user_id_user', '{{%artbox_comment}}');
$this->dropForeignKey('artbox_comment_pid_artbox_comment', '{{%artbox_comment}}');
$this->dropForeignKey('related_id_artbox_comment', '{{%artbox_comment}}');
$this->dropForeignKey('artbox_comment_id_artbox_comment', '{{%artbox_like}}');
$this->dropForeignKey('user_id_user', '{{%artbox_like}}');
$this->dropIndex('artbox_like_unique', '{{%artbox_like}}');
$this->dropTable('{{%artbox_comment}}');
$this->dropTable('{{%artbox_like}}');
}
|
d8c1a2e0
Yarik
Big commit artbox
|
112
|
}
|