@@ -7,8 +7,8 @@ class m200000_000005_change_table_v2_comments extends \yii\db\Migration
7
7
{
8
8
public function up ()
9
9
{
10
- $ this ->dropForeignKey ('fk_v2_comments_author_id_v2_users_id ' , '{{%v2_comments}} ' );
11
10
$ this ->dropForeignKey ('fk_v2_comments_post_id_v2_posts_uid ' , '{{%v2_comments}} ' );
11
+ $ this ->dropForeignKey ('fk_v2_comments_author_id_v2_users_id ' , '{{%v2_comments}} ' );
12
12
$ this ->addColumn ('{{%v2_comments}} ' , 'user_id ' , $ this ->bigInteger ()->null ()->defaultValue (null )->after ('post_id ' ));
13
13
$ this ->dropColumn ('{{%v2_comments}} ' , 'author_id ' );
14
14
$ this ->alterColumn ('{{%v2_comments}} ' , 'message ' , $ this ->text ()->notNull ());
@@ -27,7 +27,7 @@ public function down()
27
27
$ this ->alterColumn ('{{%v2_comments}} ' , 'message ' , 'json NOT NULL ' );
28
28
$ this ->addColumn ('{{%v2_comments}} ' , 'author_id ' , $ this ->integer ()->notNull ());
29
29
$ this ->dropColumn ('{{%v2_comments}} ' , 'user_id ' );
30
- $ this ->addForeignKey ('fk_v2_comments_post_id_v2_posts_uid ' , '{{%v2_comments}} ' , 'uid ' , 'v2_posts ' , 'post_id ' );
31
30
$ this ->addForeignKey ('fk_v2_comments_author_id_v2_users_id ' , '{{%v2_comments}} ' , 'id ' , 'v2_users ' , 'author_id ' );
31
+ $ this ->addForeignKey ('fk_v2_comments_post_id_v2_posts_uid ' , '{{%v2_comments}} ' , 'uid ' , 'v2_posts ' , 'post_id ' );
32
32
}
33
33
}
0 commit comments