@@ -73,30 +73,25 @@ public function clean( Collection | null $deletables = null, bool $verbose = fal
7373
7474 foreach ( $ deletables as $ deletable )
7575 {
76- $ schemas = $ this ->schemas -> values ()-> filter ( fn ( $ schema ) => $ schema -> file === $ deletable ->file );
76+ $ connection = $ this ->resolveConnection ( $ deletable ->connection );
7777
78- $ migration = $ this -> parser -> resolveMigration ( $ deletable ->file , $ schemas );
78+ $ connection -> getSchemaBuilder ()-> dropIfExists ( $ deletable ->code );
7979
80- $ this ->runReplication ( $ migration , $ schemas , ' down ' );
80+ $ this ->schemas -> pull ( $ deletable -> getName () );
8181 }
8282 }
8383
84- protected function runReplication ( Migration $ migration , Collection $ schemas, string $ method ) : void
84+ protected function runReplication ( Migration $ migration , Collection $ schemas ) : void
8585 {
8686 $ connection = $ this ->resolveConnection ( $ migration ->getConnection () );
8787
88- $ callback = function () use ( $ connection , $ migration , $ schemas, $ method )
88+ $ callback = function () use ( $ connection , $ migration , $ schemas )
8989 {
90- if ( method_exists ( $ migration , $ method ) )
90+ if ( method_exists ( $ migration , " up " ) )
9191 {
92- $ schemas ->each ( function ( $ schema ) use ( $ method )
93- {
94- if ( $ method === 'up ' ) $ this ->schemas = $ this ->schemas ->put ( $ schema ->getName (), $ schema );
95-
96- if ( $ method === 'down ' ) $ this ->schemas ->pull ( $ schema ->getName () );
97- } );
92+ $ schemas ->each ( fn ( $ schema ) => $ this ->schemas = $ this ->schemas ->put ( $ schema ->getName (), $ schema ) );
9893
99- $ this ->runMethod ( $ connection , $ migration , $ method );
94+ $ this ->runMethod ( $ connection , $ migration , " up " );
10095 }
10196 };
10297
0 commit comments