Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions src/Database/Connections/MySqlConnection.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php namespace Winter\Storm\Database\Connections;

use Illuminate\Database\Schema\MySqlSchemaState;
use Illuminate\Filesystem\Filesystem;
use PDO;
use Illuminate\Database\PDO\MySqlDriver;
use Illuminate\Database\Schema\MySqlBuilder;
Expand Down Expand Up @@ -83,4 +85,26 @@ public function bindValues($statement, $bindings)
);
}
}

/**
* Determine if the connected database is a MariaDB database.
*
* @return bool
*/
public function isMaria()
{
return str_contains($this->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);
}
}
14 changes: 14 additions & 0 deletions src/Database/Connections/PostgresConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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);
}
}
15 changes: 15 additions & 0 deletions src/Database/Connections/SQLiteConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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);
}
}
14 changes: 14 additions & 0 deletions src/Database/Connections/SqlServerConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

use Closure;
use Exception;
use Illuminate\Filesystem\Filesystem;
use Throwable;
use Illuminate\Database\Schema\SqlServerBuilder;
use Illuminate\Database\PDO\SqlServerDriver;
Expand Down Expand Up @@ -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.');
}
}
5 changes: 3 additions & 2 deletions src/Foundation/Providers/ArtisanServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,

Expand Down