Skip to content

Commit

Permalink
Fix styling
Browse files Browse the repository at this point in the history
  • Loading branch information
WatheqAlshowaiter authored and github-actions[bot] committed Aug 26, 2024
1 parent 3462945 commit 9b9b049
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 31 deletions.
16 changes: 8 additions & 8 deletions src/BackupTablesService.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
use Symfony\Component\Console\Output\ConsoleOutput;
use WatheqAlshowaiter\BackupTables\BackupTablesStrategy\SqliteBackupStrategy;
use WatheqAlshowaiter\BackupTables\BackupTablesStrategy\MysqlBackupStrategy;
use WatheqAlshowaiter\BackupTables\BackupTablesStrategy\MariaDbBackupStrategy;
use WatheqAlshowaiter\BackupTables\BackupTablesStrategy\SqlServerBackupStrategy;
use WatheqAlshowaiter\BackupTables\BackupTablesStrategy\MysqlBackupStrategy;
use WatheqAlshowaiter\BackupTables\BackupTablesStrategy\PostgresBackupStrategy;
use WatheqAlshowaiter\BackupTables\BackupTablesStrategy\SqliteBackupStrategy;
use WatheqAlshowaiter\BackupTables\BackupTablesStrategy\SqlServerBackupStrategy;

class BackupTablesService
{
Expand Down Expand Up @@ -134,15 +134,15 @@ protected function getBackupStrategy(string $databaseDriver)
{
switch ($databaseDriver) {
case 'sqlite':
return new SqliteBackupStrategy();
return new SqliteBackupStrategy;
case 'mysql':
return new MysqlBackupStrategy();
return new MysqlBackupStrategy;
case 'mariadb':
return new MariaDbBackupStrategy();
return new MariaDbBackupStrategy;
case 'pgsql':
return new PostgresBackupStrategy();
return new PostgresBackupStrategy;
case 'sqlsrv':
return new SqlServerBackupStrategy();
return new SqlServerBackupStrategy;
default:
throw new Exception('NOT SUPPORTED DATABASE DRIVER');
}
Expand Down
24 changes: 11 additions & 13 deletions src/BackupTablesStrategy/MariaDbBackupStrategy.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,17 @@

namespace WatheqAlshowaiter\BackupTables\BackupTablesStrategy;


use Illuminate\Support\Facades\DB;
use WatheqAlshowaiter\BackupTables\Constants;

class MariaDbBackupStrategy extends BackupTablesStrategy
{
public function backup($newTableName, $table): array
{
DB::statement(/**@lang MariaDB */ "CREATE TABLE $newTableName AS SELECT * FROM $table");
class MariaDbBackupStrategy extends BackupTablesStrategy
{
public function backup($newTableName, $table): array
{
DB::statement(/**@lang MariaDB */ "CREATE TABLE $newTableName AS SELECT * FROM $table");

return [
'response' => "Table '$table' completed backup successfully.",
'newCreatedTables' => "Newly created table: $newTableName",
];
}
}
return [
'response' => "Table '$table' completed backup successfully.",
'newCreatedTables' => "Newly created table: $newTableName",
];
}
}
4 changes: 1 addition & 3 deletions src/BackupTablesStrategy/MysqlBackupStrategy.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@

namespace WatheqAlshowaiter\BackupTables\BackupTablesStrategy;


use Illuminate\Support\Facades\DB;
use WatheqAlshowaiter\BackupTables\Constants;

class MysqlBackupStrategy extends BackupTablesStrategy
class MysqlBackupStrategy extends BackupTablesStrategy
{
public function backup($newTableName, $table): array
{
Expand Down
4 changes: 1 addition & 3 deletions src/BackupTablesStrategy/PostgresBackupStrategy.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,14 @@

namespace WatheqAlshowaiter\BackupTables\BackupTablesStrategy;


use Illuminate\Support\Facades\DB;

class PostgresBackupStrategy extends BackupTablesStrategy
class PostgresBackupStrategy extends BackupTablesStrategy
{
public function backup($newTableName, $table): array
{
DB::statement(/**@lang PostgreSQL */ "CREATE TABLE $newTableName AS SELECT * FROM $table");


return [
'response' => "Table '$table' completed backup successfully.",
'newCreatedTables' => "Newly created table: $newTableName",
Expand Down
3 changes: 1 addition & 2 deletions src/BackupTablesStrategy/SqlServerBackupStrategy.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@

namespace WatheqAlshowaiter\BackupTables\BackupTablesStrategy;


use Illuminate\Support\Facades\DB;

class SqlServerBackupStrategy extends BackupTablesStrategy
class SqlServerBackupStrategy extends BackupTablesStrategy
{
public function backup($newTableName, $table): array
{
Expand Down
2 changes: 0 additions & 2 deletions src/BackupTablesStrategy/SqliteBackupStrategy.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@

namespace WatheqAlshowaiter\BackupTables\BackupTablesStrategy;


use Illuminate\Support\Facades\DB;

class SqliteBackupStrategy extends BackupTablesStrategy
{

public function backup($newTableName, $table): array
{
DB::statement(/**@lang SQLite */ "CREATE TABLE $newTableName AS SELECT * FROM $table WHERE 1=0;");
Expand Down

0 comments on commit 9b9b049

Please sign in to comment.