From d68203f502a1a959fea5277b442e49fdd4d66048 Mon Sep 17 00:00:00 2001 From: Andrew Hetherington Date: Thu, 14 May 2026 14:56:16 +0100 Subject: [PATCH 1/9] Added schema dump console command --- src/Database/Connections/MySqlConnection.php | 24 +++++++++++++++++++ .../Connections/PostgresConnection.php | 14 +++++++++++ src/Database/Connections/SQLiteConnection.php | 15 ++++++++++++ .../Connections/SqlServerConnection.php | 14 +++++++++++ .../Providers/ArtisanServiceProvider.php | 5 ++-- 5 files changed, 70 insertions(+), 2 deletions(-) diff --git a/src/Database/Connections/MySqlConnection.php b/src/Database/Connections/MySqlConnection.php index 2458a9ee6..a18c77094 100644 --- a/src/Database/Connections/MySqlConnection.php +++ b/src/Database/Connections/MySqlConnection.php @@ -1,5 +1,7 @@ getPdo()->getAttribute(PDO::ATTR_SERVER_VERSION), 'MariaDB'); + } + + /** + * Get the schema state for the connection. + * + * @param \Illuminate\Filesystem\Filesystem|null $files + * @param callable|null $processFactory + * @return \Illuminate\Database\Schema\MySqlSchemaState + */ + public function getSchemaState(Filesystem $files = null, callable $processFactory = null) + { + return new MySqlSchemaState($this, $files, $processFactory); + } } diff --git a/src/Database/Connections/PostgresConnection.php b/src/Database/Connections/PostgresConnection.php index d768d69e4..ee7c8247e 100644 --- a/src/Database/Connections/PostgresConnection.php +++ b/src/Database/Connections/PostgresConnection.php @@ -3,6 +3,8 @@ use Illuminate\Database\Schema\PostgresBuilder; use Illuminate\Database\PDO\PostgresDriver; use Illuminate\Database\Query\Processors\PostgresProcessor; +use Illuminate\Database\Schema\PostgresSchemaState; +use Illuminate\Filesystem\Filesystem; use Winter\Storm\Database\Query\Grammars\PostgresGrammar as QueryGrammar; use Illuminate\Database\Schema\Grammars\PostgresGrammar as SchemaGrammar; @@ -64,4 +66,16 @@ protected function getDoctrineDriver() { return new PostgresDriver; } + + /** + * Get the schema state for the connection. + * + * @param \Illuminate\Filesystem\Filesystem|null $files + * @param callable|null $processFactory + * @return \Illuminate\Database\Schema\PostgresSchemaState + */ + public function getSchemaState(Filesystem $files = null, callable $processFactory = null) + { + return new PostgresSchemaState($this, $files, $processFactory); + } } diff --git a/src/Database/Connections/SQLiteConnection.php b/src/Database/Connections/SQLiteConnection.php index 1d6e3db1e..2b85359e5 100644 --- a/src/Database/Connections/SQLiteConnection.php +++ b/src/Database/Connections/SQLiteConnection.php @@ -3,6 +3,8 @@ use Illuminate\Database\Schema\SQLiteBuilder; use Illuminate\Database\Query\Processors\SQLiteProcessor; use Illuminate\Database\PDO\SQLiteDriver; +use Illuminate\Database\Schema\SqliteSchemaState; +use Illuminate\Filesystem\Filesystem; use Winter\Storm\Database\Query\Grammars\SQLiteGrammar as QueryGrammar; use Illuminate\Database\Schema\Grammars\SQLiteGrammar as SchemaGrammar; @@ -64,4 +66,17 @@ protected function getDoctrineDriver() { return new SQLiteDriver; } + + /** + * Get the schema state for the connection. + * + * @param \Illuminate\Filesystem\Filesystem|null $files + * @param callable|null $processFactory + * + * @throws \RuntimeException + */ + public function getSchemaState(Filesystem $files = null, callable $processFactory = null) + { + return new SqliteSchemaState($this, $files, $processFactory); + } } diff --git a/src/Database/Connections/SqlServerConnection.php b/src/Database/Connections/SqlServerConnection.php index 07a6af21a..5bcdde0cc 100644 --- a/src/Database/Connections/SqlServerConnection.php +++ b/src/Database/Connections/SqlServerConnection.php @@ -2,6 +2,7 @@ use Closure; use Exception; +use Illuminate\Filesystem\Filesystem; use Throwable; use Illuminate\Database\Schema\SqlServerBuilder; use Illuminate\Database\PDO\SqlServerDriver; @@ -110,4 +111,17 @@ protected function getDoctrineDriver() { return new SqlServerDriver; } + + /** + * Get the schema state for the connection. + * + * @param \Illuminate\Filesystem\Filesystem|null $files + * @param callable|null $processFactory + * + * @throws \RuntimeException + */ + public function getSchemaState(Filesystem $files = null, callable $processFactory = null) + { + throw new RuntimeException('Schema dumping is not supported when using SQL Server.'); + } } diff --git a/src/Foundation/Providers/ArtisanServiceProvider.php b/src/Foundation/Providers/ArtisanServiceProvider.php index 38cd75577..a476df894 100644 --- a/src/Foundation/Providers/ArtisanServiceProvider.php +++ b/src/Foundation/Providers/ArtisanServiceProvider.php @@ -49,16 +49,17 @@ class ArtisanServiceProvider extends ArtisanServiceProviderBase 'ScheduleWork' => \Illuminate\Console\Scheduling\ScheduleWorkCommand::class, 'Up' => \Illuminate\Foundation\Console\UpCommand::class, 'ViewClear' => \Illuminate\Foundation\Console\ViewClearCommand::class, + 'SchemaDump' => \Illuminate\Database\Console\DumpCommand::class, // Currently unsupported in Winter: // @TODO: Assess for inclusion // 'ClearResets' => ClearResetsCommand::class, - // 'Db' => DbCommand::class, + //'Db' => DbCommand::class, // 'DbPrune' => PruneCommand::class, // 'DbWipe' => WipeCommand::class, // 'OptimizeClear' => OptimizeClearCommand::class, // 'QueueClear' => QueueClearCommand::class, - // 'SchemaDump' => DumpCommand::class, + 'SchemaDump' => DumpCommand::class, // 'ScheduleClearCache' => ScheduleClearCacheCommand::class, // 'ViewCache' => ViewCacheCommand::class, From a3704d39e50c3b5f359a1bd7d364791d6f3b9de7 Mon Sep 17 00:00:00 2001 From: Andrew Hetherington Date: Thu, 14 May 2026 14:56:16 +0100 Subject: [PATCH 2/9] Added schema dump console command --- src/Database/Connections/MySqlConnection.php | 24 +++++++++++++++++++ .../Connections/PostgresConnection.php | 14 +++++++++++ src/Database/Connections/SQLiteConnection.php | 15 ++++++++++++ .../Connections/SqlServerConnection.php | 14 +++++++++++ 4 files changed, 67 insertions(+) diff --git a/src/Database/Connections/MySqlConnection.php b/src/Database/Connections/MySqlConnection.php index 2458a9ee6..a18c77094 100644 --- a/src/Database/Connections/MySqlConnection.php +++ b/src/Database/Connections/MySqlConnection.php @@ -1,5 +1,7 @@ getPdo()->getAttribute(PDO::ATTR_SERVER_VERSION), 'MariaDB'); + } + + /** + * Get the schema state for the connection. + * + * @param \Illuminate\Filesystem\Filesystem|null $files + * @param callable|null $processFactory + * @return \Illuminate\Database\Schema\MySqlSchemaState + */ + public function getSchemaState(Filesystem $files = null, callable $processFactory = null) + { + return new MySqlSchemaState($this, $files, $processFactory); + } } diff --git a/src/Database/Connections/PostgresConnection.php b/src/Database/Connections/PostgresConnection.php index d768d69e4..ee7c8247e 100644 --- a/src/Database/Connections/PostgresConnection.php +++ b/src/Database/Connections/PostgresConnection.php @@ -3,6 +3,8 @@ use Illuminate\Database\Schema\PostgresBuilder; use Illuminate\Database\PDO\PostgresDriver; use Illuminate\Database\Query\Processors\PostgresProcessor; +use Illuminate\Database\Schema\PostgresSchemaState; +use Illuminate\Filesystem\Filesystem; use Winter\Storm\Database\Query\Grammars\PostgresGrammar as QueryGrammar; use Illuminate\Database\Schema\Grammars\PostgresGrammar as SchemaGrammar; @@ -64,4 +66,16 @@ protected function getDoctrineDriver() { return new PostgresDriver; } + + /** + * Get the schema state for the connection. + * + * @param \Illuminate\Filesystem\Filesystem|null $files + * @param callable|null $processFactory + * @return \Illuminate\Database\Schema\PostgresSchemaState + */ + public function getSchemaState(Filesystem $files = null, callable $processFactory = null) + { + return new PostgresSchemaState($this, $files, $processFactory); + } } diff --git a/src/Database/Connections/SQLiteConnection.php b/src/Database/Connections/SQLiteConnection.php index 1d6e3db1e..2b85359e5 100644 --- a/src/Database/Connections/SQLiteConnection.php +++ b/src/Database/Connections/SQLiteConnection.php @@ -3,6 +3,8 @@ use Illuminate\Database\Schema\SQLiteBuilder; use Illuminate\Database\Query\Processors\SQLiteProcessor; use Illuminate\Database\PDO\SQLiteDriver; +use Illuminate\Database\Schema\SqliteSchemaState; +use Illuminate\Filesystem\Filesystem; use Winter\Storm\Database\Query\Grammars\SQLiteGrammar as QueryGrammar; use Illuminate\Database\Schema\Grammars\SQLiteGrammar as SchemaGrammar; @@ -64,4 +66,17 @@ protected function getDoctrineDriver() { return new SQLiteDriver; } + + /** + * Get the schema state for the connection. + * + * @param \Illuminate\Filesystem\Filesystem|null $files + * @param callable|null $processFactory + * + * @throws \RuntimeException + */ + public function getSchemaState(Filesystem $files = null, callable $processFactory = null) + { + return new SqliteSchemaState($this, $files, $processFactory); + } } diff --git a/src/Database/Connections/SqlServerConnection.php b/src/Database/Connections/SqlServerConnection.php index 07a6af21a..5bcdde0cc 100644 --- a/src/Database/Connections/SqlServerConnection.php +++ b/src/Database/Connections/SqlServerConnection.php @@ -2,6 +2,7 @@ use Closure; use Exception; +use Illuminate\Filesystem\Filesystem; use Throwable; use Illuminate\Database\Schema\SqlServerBuilder; use Illuminate\Database\PDO\SqlServerDriver; @@ -110,4 +111,17 @@ protected function getDoctrineDriver() { return new SqlServerDriver; } + + /** + * Get the schema state for the connection. + * + * @param \Illuminate\Filesystem\Filesystem|null $files + * @param callable|null $processFactory + * + * @throws \RuntimeException + */ + public function getSchemaState(Filesystem $files = null, callable $processFactory = null) + { + throw new RuntimeException('Schema dumping is not supported when using SQL Server.'); + } } From b9ac4c5a52887ad02439c99286b46d3a980db5e9 Mon Sep 17 00:00:00 2001 From: Andrew Hetherington Date: Tue, 26 May 2026 10:59:14 +0100 Subject: [PATCH 3/9] Added schema dump console command --- src/Foundation/Providers/ArtisanServiceProvider.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Foundation/Providers/ArtisanServiceProvider.php b/src/Foundation/Providers/ArtisanServiceProvider.php index 38cd75577..681b18059 100644 --- a/src/Foundation/Providers/ArtisanServiceProvider.php +++ b/src/Foundation/Providers/ArtisanServiceProvider.php @@ -49,6 +49,7 @@ class ArtisanServiceProvider extends ArtisanServiceProviderBase 'ScheduleWork' => \Illuminate\Console\Scheduling\ScheduleWorkCommand::class, 'Up' => \Illuminate\Foundation\Console\UpCommand::class, 'ViewClear' => \Illuminate\Foundation\Console\ViewClearCommand::class, + 'SchemaDump' => \Illuminate\Database\Console\DumpCommand::class, // Currently unsupported in Winter: // @TODO: Assess for inclusion From 009d1e4901be798dc2feb20cb8f42e7c0fb70ddf Mon Sep 17 00:00:00 2001 From: Luke Towers Date: Wed, 27 May 2026 14:39:28 -0600 Subject: [PATCH 4/9] Apply suggestions from code review Co-authored-by: Luke Towers --- src/Foundation/Providers/ArtisanServiceProvider.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Foundation/Providers/ArtisanServiceProvider.php b/src/Foundation/Providers/ArtisanServiceProvider.php index a476df894..62a26b684 100644 --- a/src/Foundation/Providers/ArtisanServiceProvider.php +++ b/src/Foundation/Providers/ArtisanServiceProvider.php @@ -49,7 +49,14 @@ class ArtisanServiceProvider extends ArtisanServiceProviderBase 'ScheduleWork' => \Illuminate\Console\Scheduling\ScheduleWorkCommand::class, 'Up' => \Illuminate\Foundation\Console\UpCommand::class, 'ViewClear' => \Illuminate\Foundation\Console\ViewClearCommand::class, - 'SchemaDump' => \Illuminate\Database\Console\DumpCommand::class, +'ScheduleFinish' => \Illuminate\Console\Scheduling\ScheduleFinishCommand::class, +'ScheduleList' => \Illuminate\Console\Scheduling\ScheduleListCommand::class, +'ScheduleRun' => \Illuminate\Console\Scheduling\ScheduleRunCommand::class, +'ScheduleTest' => \Illuminate\Console\Scheduling\ScheduleTestCommand::class, +'ScheduleWork' => \Illuminate\Console\Scheduling\ScheduleWorkCommand::class, +'SchemaDump' => \Illuminate\Database\Console\DumpCommand::class, +'Up' => \Illuminate\Foundation\Console\UpCommand::class, +'ViewClear' => \Illuminate\Foundation\Console\ViewClearCommand::class, // Currently unsupported in Winter: // @TODO: Assess for inclusion @@ -59,7 +66,6 @@ class ArtisanServiceProvider extends ArtisanServiceProviderBase // 'DbWipe' => WipeCommand::class, // 'OptimizeClear' => OptimizeClearCommand::class, // 'QueueClear' => QueueClearCommand::class, - 'SchemaDump' => DumpCommand::class, // 'ScheduleClearCache' => ScheduleClearCacheCommand::class, // 'ViewCache' => ViewCacheCommand::class, From b404defe47e377437067134ab96ec8ca8c6b70eb Mon Sep 17 00:00:00 2001 From: Luke Towers Date: Wed, 27 May 2026 14:40:35 -0600 Subject: [PATCH 5/9] Fix --- src/Foundation/Providers/ArtisanServiceProvider.php | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/Foundation/Providers/ArtisanServiceProvider.php b/src/Foundation/Providers/ArtisanServiceProvider.php index 62a26b684..6fe237726 100644 --- a/src/Foundation/Providers/ArtisanServiceProvider.php +++ b/src/Foundation/Providers/ArtisanServiceProvider.php @@ -47,16 +47,9 @@ class ArtisanServiceProvider extends ArtisanServiceProviderBase 'ScheduleRun' => \Illuminate\Console\Scheduling\ScheduleRunCommand::class, 'ScheduleTest' => \Illuminate\Console\Scheduling\ScheduleTestCommand::class, 'ScheduleWork' => \Illuminate\Console\Scheduling\ScheduleWorkCommand::class, + 'SchemaDump' => \Illuminate\Database\Console\DumpCommand::class, 'Up' => \Illuminate\Foundation\Console\UpCommand::class, 'ViewClear' => \Illuminate\Foundation\Console\ViewClearCommand::class, -'ScheduleFinish' => \Illuminate\Console\Scheduling\ScheduleFinishCommand::class, -'ScheduleList' => \Illuminate\Console\Scheduling\ScheduleListCommand::class, -'ScheduleRun' => \Illuminate\Console\Scheduling\ScheduleRunCommand::class, -'ScheduleTest' => \Illuminate\Console\Scheduling\ScheduleTestCommand::class, -'ScheduleWork' => \Illuminate\Console\Scheduling\ScheduleWorkCommand::class, -'SchemaDump' => \Illuminate\Database\Console\DumpCommand::class, -'Up' => \Illuminate\Foundation\Console\UpCommand::class, -'ViewClear' => \Illuminate\Foundation\Console\ViewClearCommand::class, // Currently unsupported in Winter: // @TODO: Assess for inclusion From 7afc9f89ee6e4adc104cea73e5c4500521334c1f Mon Sep 17 00:00:00 2001 From: Luke Towers Date: Wed, 27 May 2026 14:41:45 -0600 Subject: [PATCH 6/9] Fix imports --- src/Database/Connections/SqlServerConnection.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Database/Connections/SqlServerConnection.php b/src/Database/Connections/SqlServerConnection.php index 5bcdde0cc..6351a1299 100644 --- a/src/Database/Connections/SqlServerConnection.php +++ b/src/Database/Connections/SqlServerConnection.php @@ -1,13 +1,16 @@ - Date: Wed, 27 May 2026 14:42:26 -0600 Subject: [PATCH 7/9] whitespace --- src/Foundation/Providers/ArtisanServiceProvider.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Foundation/Providers/ArtisanServiceProvider.php b/src/Foundation/Providers/ArtisanServiceProvider.php index 6fe237726..b22bb2049 100644 --- a/src/Foundation/Providers/ArtisanServiceProvider.php +++ b/src/Foundation/Providers/ArtisanServiceProvider.php @@ -54,7 +54,7 @@ class ArtisanServiceProvider extends ArtisanServiceProviderBase // Currently unsupported in Winter: // @TODO: Assess for inclusion // 'ClearResets' => ClearResetsCommand::class, - //'Db' => DbCommand::class, + // 'Db' => DbCommand::class, // 'DbPrune' => PruneCommand::class, // 'DbWipe' => WipeCommand::class, // 'OptimizeClear' => OptimizeClearCommand::class, From 838d03a02db088a722fb82229fc78500b4b94136 Mon Sep 17 00:00:00 2001 From: Luke Towers Date: Wed, 27 May 2026 14:43:47 -0600 Subject: [PATCH 8/9] lint --- src/Database/Connections/SqlServerConnection.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Database/Connections/SqlServerConnection.php b/src/Database/Connections/SqlServerConnection.php index 6351a1299..938b4b123 100644 --- a/src/Database/Connections/SqlServerConnection.php +++ b/src/Database/Connections/SqlServerConnection.php @@ -1,4 +1,4 @@ - Date: Wed, 27 May 2026 14:49:29 -0600 Subject: [PATCH 9/9] Apply suggestions from code review Co-authored-by: Luke Towers --- src/Database/Connections/MySqlConnection.php | 2 +- src/Database/Connections/PostgresConnection.php | 2 +- src/Database/Connections/SQLiteConnection.php | 2 +- src/Database/Connections/SqlServerConnection.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Database/Connections/MySqlConnection.php b/src/Database/Connections/MySqlConnection.php index a18c77094..1820fa422 100644 --- a/src/Database/Connections/MySqlConnection.php +++ b/src/Database/Connections/MySqlConnection.php @@ -103,7 +103,7 @@ public function isMaria() * @param callable|null $processFactory * @return \Illuminate\Database\Schema\MySqlSchemaState */ - public function getSchemaState(Filesystem $files = null, callable $processFactory = null) + public function getSchemaState(?Filesystem $files = null, ?callable $processFactory = null) { return new MySqlSchemaState($this, $files, $processFactory); } diff --git a/src/Database/Connections/PostgresConnection.php b/src/Database/Connections/PostgresConnection.php index ee7c8247e..d71732d96 100644 --- a/src/Database/Connections/PostgresConnection.php +++ b/src/Database/Connections/PostgresConnection.php @@ -74,7 +74,7 @@ protected function getDoctrineDriver() * @param callable|null $processFactory * @return \Illuminate\Database\Schema\PostgresSchemaState */ - public function getSchemaState(Filesystem $files = null, callable $processFactory = null) + public function getSchemaState(?Filesystem $files = null, ?callable $processFactory = null) { return new PostgresSchemaState($this, $files, $processFactory); } diff --git a/src/Database/Connections/SQLiteConnection.php b/src/Database/Connections/SQLiteConnection.php index 2b85359e5..3ab2d7cdd 100644 --- a/src/Database/Connections/SQLiteConnection.php +++ b/src/Database/Connections/SQLiteConnection.php @@ -75,7 +75,7 @@ protected function getDoctrineDriver() * * @throws \RuntimeException */ - public function getSchemaState(Filesystem $files = null, callable $processFactory = null) + public function getSchemaState(?Filesystem $files = null, ?callable $processFactory = null) { return new SqliteSchemaState($this, $files, $processFactory); } diff --git a/src/Database/Connections/SqlServerConnection.php b/src/Database/Connections/SqlServerConnection.php index 938b4b123..72cc16f36 100644 --- a/src/Database/Connections/SqlServerConnection.php +++ b/src/Database/Connections/SqlServerConnection.php @@ -123,7 +123,7 @@ protected function getDoctrineDriver() * * @throws \RuntimeException */ - public function getSchemaState(Filesystem $files = null, callable $processFactory = null) + public function getSchemaState(?Filesystem $files = null, ?callable $processFactory = null) { throw new RuntimeException('Schema dumping is not supported when using SQL Server.'); }