@@ -344,29 +344,17 @@ private function createTablesForCreateMigrationForDropTable132()
344344
345345 private function deleteTablesForCreateMigrationForDropTable132 ()
346346 {
347- $ tableSchema = Yii::$ app ->db ->schema ->getTableSchema ('{{%pristines}} ' );
348- if ($ tableSchema && array_key_exists ('name ' , $ tableSchema ->foreignKeys )) {
349- Yii::$ app ->db ->createCommand ()->dropForeignKey ('name ' , '{{%pristines}} ' )->execute ();
350- }
351-
347+ $ this ->dropFkIfExists ('{{%pristines}} ' , 'name ' );
352348 Yii::$ app ->db ->createCommand ('DROP TABLE IF EXISTS {{%pristines}} ' )->execute ();
353349
354- $ tableSchema = Yii::$ app ->db ->schema ->getTableSchema ('{{%fruits}} ' );
355- if ($ tableSchema && array_key_exists ('name2 ' , $ tableSchema ->foreignKeys )) {
356- Yii::$ app ->db ->createCommand ()->dropForeignKey ('name2 ' , '{{%fruits}} ' )->execute ();
357- }
358-
350+ $ this ->dropFkIfExists ('{{%fruits}} ' , 'name2 ' );
359351 Yii::$ app ->db ->createCommand ('DROP TABLE IF EXISTS {{%fruits}} ' )->execute ();
360352
361353 Yii::$ app ->db ->createCommand ('DROP TABLE IF EXISTS {{%upks}} ' )->execute ();
362354 Yii::$ app ->db ->createCommand ('DROP TABLE IF EXISTS {{%bigpks}} ' )->execute ();
363355 Yii::$ app ->db ->createCommand ('DROP TABLE IF EXISTS {{%ubigpks}} ' )->execute ();
364356
365- $ tableSchema = Yii::$ app ->db ->schema ->getTableSchema ('{{%the_mango_table_name}} ' );
366- if ($ tableSchema && array_key_exists ('animal_fruit_fk ' , $ tableSchema ->foreignKeys )) {
367- Yii::$ app ->db ->createCommand ()->dropForeignKey ('animal_fruit_fk ' , '{{%the_mango_table_name}} ' )->execute ();
368- }
369-
357+ $ this ->dropFkIfExists ('{{%the_mango_table_name}} ' , 'animal_fruit_fk ' );
370358 Yii::$ app ->db ->createCommand ('DROP TABLE IF EXISTS {{%the_mango_table_name}} ' )->execute ();
371359 Yii::$ app ->db ->createCommand ('DROP TABLE IF EXISTS {{%the_animal_table_name}} ' )->execute ();
372360 }
0 commit comments