@@ -7,8 +7,8 @@ class m200000_000005_change_table_v2_comments extends \yii\db\Migration
77{
88 public function up ()
99 {
10- $ this ->dropForeignKey ('fk_v2_comments_author_id_v2_users_id ' , '{{%v2_comments}} ' );
1110 $ 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}} ' );
1212 $ this ->addColumn ('{{%v2_comments}} ' , 'user_id ' , $ this ->bigInteger ()->null ()->defaultValue (null )->after ('post_id ' ));
1313 $ this ->dropColumn ('{{%v2_comments}} ' , 'author_id ' );
1414 $ this ->alterColumn ('{{%v2_comments}} ' , 'message ' , $ this ->text ()->notNull ());
@@ -27,7 +27,7 @@ public function down()
2727 $ this ->alterColumn ('{{%v2_comments}} ' , 'message ' , 'json NOT NULL ' );
2828 $ this ->addColumn ('{{%v2_comments}} ' , 'author_id ' , $ this ->integer ()->notNull ());
2929 $ this ->dropColumn ('{{%v2_comments}} ' , 'user_id ' );
30- $ this ->addForeignKey ('fk_v2_comments_post_id_v2_posts_uid ' , '{{%v2_comments}} ' , 'uid ' , 'v2_posts ' , 'post_id ' );
3130 $ 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 ' );
3232 }
3333}
0 commit comments