3636 * Generates migration file based on the existing database table and previous migrations.
3737 *
3838 * @author Paweł Bizley Brzozowski
39- * @version 3.2 .0
39+ * @version 3.3 .0
4040 * @license Apache 2.0
4141 * https://github.com/bizley/yii2-migration
4242 */
@@ -45,7 +45,7 @@ class MigrationController extends Controller
4545 /**
4646 * @var string
4747 */
48- protected $ version = '3.2 .0 ' ;
48+ protected $ version = '3.3 .0 ' ;
4949
5050 /**
5151 * @var string Default command action.
@@ -273,27 +273,27 @@ public function init(): void
273273 */
274274 public function beforeAction ($ action ): bool // BC declaration
275275 {
276- if (parent ::beforeAction ($ action )) {
277- if (!$ this ->showOnly && in_array ($ action ->id , ['create ' , 'create-all ' , 'update ' , 'update-all ' ], true )) {
278- if ($ this ->migrationPath !== null ) {
279- $ this ->migrationPath = $ this ->preparePathDirectory ($ this ->migrationPath );
280- }
276+ if (!parent ::beforeAction ($ action )) {
277+ return false ;
278+ }
281279
282- if ($ this ->migrationNamespace !== null ) {
283- $ this ->migrationNamespace = FileHelper::normalizePath ($ this ->migrationNamespace , '\\' );
284- $ this ->workingPath = $ this ->preparePathDirectory (FileHelper::normalizePath ('@ ' . $ this ->migrationNamespace , '/ ' ));
285- } else {
286- $ this ->workingPath = $ this ->migrationPath ;
287- }
280+ if (!$ this ->showOnly && in_array ($ action ->id , ['create ' , 'create-all ' , 'update ' , 'update-all ' ], true )) {
281+ if ($ this ->migrationPath !== null ) {
282+ $ this ->migrationPath = $ this ->preparePathDirectory ($ this ->migrationPath );
288283 }
289284
290- $ this ->db = Instance::ensure ($ this ->db , Connection::class);
291- $ this ->stdout ("Yii 2 Migration Generator Tool v {$ this ->version }\n\n" , Console::FG_CYAN );
292-
293- return true ;
285+ if ($ this ->migrationNamespace !== null ) {
286+ $ this ->migrationNamespace = FileHelper::normalizePath ($ this ->migrationNamespace , '\\' );
287+ $ this ->workingPath = $ this ->preparePathDirectory (FileHelper::normalizePath ('@ ' . $ this ->migrationNamespace , '/ ' ));
288+ } else {
289+ $ this ->workingPath = $ this ->migrationPath ;
290+ }
294291 }
295292
296- return false ;
293+ $ this ->db = Instance::ensure ($ this ->db , Connection::class);
294+ $ this ->stdout ("Yii 2 Migration Generator Tool v {$ this ->version }\n\n" , Console::FG_CYAN );
295+
296+ return true ;
297297 }
298298
299299 /**
@@ -635,32 +635,6 @@ public function actionUpdateAll(): int
635635 return ExitCode::OK ;
636636 }
637637
638- /**
639- * Removes migration history table name from the tables list.
640- * @param array $tables
641- * @return array
642- * @since 3.0.0
643- * @deprecated in 3.1.0, will be removed in 3.3.0
644- */
645- public function removeMigrationTable (array $ tables ): array
646- {
647- if (!$ tables ) {
648- return [];
649- }
650-
651- $ filteredTables = [];
652-
653- foreach ($ tables as $ table ) {
654- if ($ this ->db ->schema ->getRawTableName ($ this ->migrationTable ) === $ table ) {
655- continue ;
656- }
657-
658- $ filteredTables [] = $ table ;
659- }
660-
661- return $ filteredTables ;
662- }
663-
664638 /**
665639 * Removes excluded tables names from the tables list.
666640 * @param array $tables
0 commit comments