From 221385bcaee6ebb5221b17f2cc6854eb3416981e Mon Sep 17 00:00:00 2001 From: Ahmad Syamim Date: Thu, 26 Jan 2023 14:53:06 +0800 Subject: [PATCH 1/4] features: sort tables before generate --- src/MigrateGenerateCommand.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/MigrateGenerateCommand.php b/src/MigrateGenerateCommand.php index bc8c1f33..cf1bd435 100644 --- a/src/MigrateGenerateCommand.php +++ b/src/MigrateGenerateCommand.php @@ -113,8 +113,8 @@ public function handle(): void $this->info('Using connection: ' . $connection . "\n"); - $tables = $this->filterTables(); - $views = $this->filterViews(); + $tables = $this->filterTables()->sortBy(function($value, $key) {return (string) $value;}, SORT_STRING); + $views = $this->filterViews()->sortBy(function($value, $key) {return (string) $value;}, SORT_STRING); $generateList = $tables->merge($views)->unique(); $this->info('Generating migrations for: ' . $generateList->implode(',') . "\n"); From be6e4652cf722f4dd9679e5d141a58ceedc35cd5 Mon Sep 17 00:00:00 2001 From: Ahmad Syamim Date: Tue, 31 Jan 2023 07:11:35 +0800 Subject: [PATCH 2/4] Update MigrateGenerateCommand.php --- src/MigrateGenerateCommand.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/MigrateGenerateCommand.php b/src/MigrateGenerateCommand.php index cf1bd435..838bf578 100644 --- a/src/MigrateGenerateCommand.php +++ b/src/MigrateGenerateCommand.php @@ -113,8 +113,12 @@ public function handle(): void $this->info('Using connection: ' . $connection . "\n"); - $tables = $this->filterTables()->sortBy(function($value, $key) {return (string) $value;}, SORT_STRING); - $views = $this->filterViews()->sortBy(function($value, $key) {return (string) $value;}, SORT_STRING); + $tables = $this->filterTables()->sortBy(function ($value, $key) { + return (string) $value; + }, SORT_STRING); + $views = $this->filterViews()->sortBy(function ($value, $key) { + return (string) $value; + }, SORT_STRING); $generateList = $tables->merge($views)->unique(); $this->info('Generating migrations for: ' . $generateList->implode(',') . "\n"); From ab66684e93afe315a591fadafa3cdfbe2409ec0c Mon Sep 17 00:00:00 2001 From: Ahmad Syamim Date: Tue, 7 Feb 2023 00:07:38 +0800 Subject: [PATCH 3/4] Update MigrateGenerateCommand.php --- src/MigrateGenerateCommand.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/MigrateGenerateCommand.php b/src/MigrateGenerateCommand.php index 838bf578..21b9f373 100644 --- a/src/MigrateGenerateCommand.php +++ b/src/MigrateGenerateCommand.php @@ -113,10 +113,10 @@ public function handle(): void $this->info('Using connection: ' . $connection . "\n"); - $tables = $this->filterTables()->sortBy(function ($value, $key) { + $tables = $this->filterTables()->sortBy(function ($value) { return (string) $value; }, SORT_STRING); - $views = $this->filterViews()->sortBy(function ($value, $key) { + $views = $this->filterViews()->sortBy(function ($value) { return (string) $value; }, SORT_STRING); $generateList = $tables->merge($views)->unique(); From 5d70ec7e2cd460d30415de0ef79c63a329df572b Mon Sep 17 00:00:00 2001 From: Kit Loong Date: Sun, 19 Feb 2023 00:53:54 +0800 Subject: [PATCH 4/4] Simplify sort --- src/MigrateGenerateCommand.php | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/MigrateGenerateCommand.php b/src/MigrateGenerateCommand.php index 21b9f373..dccf7a1d 100644 --- a/src/MigrateGenerateCommand.php +++ b/src/MigrateGenerateCommand.php @@ -113,12 +113,8 @@ public function handle(): void $this->info('Using connection: ' . $connection . "\n"); - $tables = $this->filterTables()->sortBy(function ($value) { - return (string) $value; - }, SORT_STRING); - $views = $this->filterViews()->sortBy(function ($value) { - return (string) $value; - }, SORT_STRING); + $tables = $this->filterTables()->sort()->values(); + $views = $this->filterViews()->sort()->values(); $generateList = $tables->merge($views)->unique(); $this->info('Generating migrations for: ' . $generateList->implode(',') . "\n");