@@ -277,31 +277,33 @@ public function testNullableFalseInRequired()
277
277
278
278
// Create migration for drop table if a entire schema is deleted from OpenAPI spec #132
279
279
// https://github.com/cebe/yii2-openapi/issues/132
280
- public function testCreateMigrationForDropTable132 ()
281
- {
282
- // $this->changeDbToMariadb();
283
- $ testFile = Yii::getAlias ("@specs/issue_fix/132_create_migration_for_drop_table/132_create_migration_for_drop_table.php " );
284
- // $this->deleteTablesForCreateMigrationForDropTable132();
285
- $ this ->createTablesForCreateMigrationForDropTable132 ();
286
- // sleep(3000);
287
- $ this ->runGenerator ($ testFile );
288
- // $this->runActualMigrations('mysql', 3);
289
- // ... TODO
290
- $ this ->deleteTablesForCreateMigrationForDropTable132 ();
291
- // $this->deleteTables();
292
- }
280
+ public function testCreateMigrationForDropTable132 ()
281
+ {
282
+ $ testFile = Yii::getAlias ("@specs/issue_fix/132_create_migration_for_drop_table/132_create_migration_for_drop_table.php " );
283
+ // $this->deleteTablesForCreateMigrationForDropTable132();
284
+ $ this ->createTablesForCreateMigrationForDropTable132 ();
285
+ $ this ->runGenerator ($ testFile );
286
+ $ this ->runActualMigrations ('mysql ' , 3 );
287
+ // ... TODO compare files
288
+ $ this ->deleteTablesForCreateMigrationForDropTable132 ();
289
+ // $this->deleteTables();
290
+ }
293
291
294
292
private function createTablesForCreateMigrationForDropTable132 ()
295
293
{
294
+ // Yii::$app->db->createCommand()->createTable('{{%upks}}', [
295
+ // 'id' => 'upk',
296
+ // 'name' => 'string(150)',
297
+ // ])->execute();
298
+
296
299
Yii::$ app ->db ->createCommand ()->createTable ('{{%fruits}} ' , [
297
- 'id ' => 'ubigpk ' ,
300
+ 'id ' => 'pk ' ,
298
301
'name ' => 'string(150) ' ,
299
302
])->execute ();
300
303
Yii::$ app ->db ->createCommand ()->createTable ('{{%pristines}} ' , [
301
304
'id ' => 'pk ' ,
302
305
'name ' => 'string(151) ' ,
303
- 'fruit_id ' => 'bigint unsigned ' , // FK
304
- // 'fruit_id' => $this->integer()->unsigned(), // FK
306
+ 'fruit_id ' => 'int ' , // FK
305
307
])->execute ();
306
308
Yii::$ app ->db ->createCommand ()->addForeignKey ('name ' , '{{%pristines}} ' , 'fruit_id ' , '{{%fruits}} ' , 'id ' )->execute ();
307
309
}
@@ -311,6 +313,7 @@ private function deleteTablesForCreateMigrationForDropTable132()
311
313
Yii::$ app ->db ->createCommand ()->dropForeignKey ('name ' , '{{%pristines}} ' )->execute ();
312
314
Yii::$ app ->db ->createCommand ('DROP TABLE IF EXISTS {{%pristines}} ' )->execute ();
313
315
Yii::$ app ->db ->createCommand ('DROP TABLE IF EXISTS {{%fruits}} ' )->execute ();
316
+ Yii::$ app ->db ->createCommand ('DROP TABLE IF EXISTS {{%upks}} ' )->execute ();
314
317
}
315
318
316
319
public function test162BugDollarrefWithXFaker ()
0 commit comments