Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[12.x] Improve queries readablility #54791

Merged
merged 2 commits into from
Feb 25, 2025
Merged
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
4 changes: 2 additions & 2 deletions src/Illuminate/Database/Schema/Grammars/MySqlGrammar.php
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,7 @@ public function compileRenameIndex(Blueprint $blueprint, Fluent $command)
*/
public function compileDropAllTables($tables)
{
return 'drop table '.implode(',', $this->wrapArray($tables));
return 'drop table '.implode(', ', $this->wrapArray($tables));
}

/**
Expand All @@ -664,7 +664,7 @@ public function compileDropAllTables($tables)
*/
public function compileDropAllViews($views)
{
return 'drop view '.implode(',', $this->wrapArray($views));
return 'drop view '.implode(', ', $this->wrapArray($views));
}

/**
Expand Down
8 changes: 4 additions & 4 deletions src/Illuminate/Database/Schema/Grammars/PostgresGrammar.php
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ public function compileDropIfExists(Blueprint $blueprint, Fluent $command)
*/
public function compileDropAllTables($tables)
{
return 'drop table '.implode(',', $this->escapeNames($tables)).' cascade';
return 'drop table '.implode(', ', $this->escapeNames($tables)).' cascade';
}

/**
Expand All @@ -474,7 +474,7 @@ public function compileDropAllTables($tables)
*/
public function compileDropAllViews($views)
{
return 'drop view '.implode(',', $this->escapeNames($views)).' cascade';
return 'drop view '.implode(', ', $this->escapeNames($views)).' cascade';
}

/**
Expand All @@ -485,7 +485,7 @@ public function compileDropAllViews($views)
*/
public function compileDropAllTypes($types)
{
return 'drop type '.implode(',', $this->escapeNames($types)).' cascade';
return 'drop type '.implode(', ', $this->escapeNames($types)).' cascade';
}

/**
Expand All @@ -496,7 +496,7 @@ public function compileDropAllTypes($types)
*/
public function compileDropAllDomains($domains)
{
return 'drop domain '.implode(',', $this->escapeNames($domains)).' cascade';
return 'drop domain '.implode(', ', $this->escapeNames($domains)).' cascade';
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ public function compileDropDefaultConstraint(Blueprint $blueprint, Fluent $comma
{
$columns = $command->name === 'change'
? "'".$command->column->name."'"
: "'".implode("','", $command->columns)."'";
: "'".implode("', '", $command->columns)."'";

$table = $this->wrapTable($blueprint);
$tableName = $this->quoteString($this->wrapTable($blueprint));
Expand Down
4 changes: 2 additions & 2 deletions tests/Database/DatabaseMariaDbSchemaGrammarTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1471,14 +1471,14 @@ public function testDropAllTables()
$connection = $this->getConnection();
$statement = $this->getGrammar($connection)->compileDropAllTables(['alpha', 'beta', 'gamma']);

$this->assertSame('drop table `alpha`,`beta`,`gamma`', $statement);
$this->assertSame('drop table `alpha`, `beta`, `gamma`', $statement);
}

public function testDropAllViews()
{
$statement = $this->getGrammar()->compileDropAllViews(['alpha', 'beta', 'gamma']);

$this->assertSame('drop view `alpha`,`beta`,`gamma`', $statement);
$this->assertSame('drop view `alpha`, `beta`, `gamma`', $statement);
}

public function testGrammarsAreMacroable()
Expand Down
4 changes: 2 additions & 2 deletions tests/Database/DatabaseMySqlSchemaGrammarTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1480,14 +1480,14 @@ public function testDropAllTables()
{
$statement = $this->getGrammar()->compileDropAllTables(['alpha', 'beta', 'gamma']);

$this->assertSame('drop table `alpha`,`beta`,`gamma`', $statement);
$this->assertSame('drop table `alpha`, `beta`, `gamma`', $statement);
}

public function testDropAllViews()
{
$statement = $this->getGrammar()->compileDropAllViews(['alpha', 'beta', 'gamma']);

$this->assertSame('drop view `alpha`,`beta`,`gamma`', $statement);
$this->assertSame('drop view `alpha`, `beta`, `gamma`', $statement);
}

public function testGrammarsAreMacroable()
Expand Down
6 changes: 3 additions & 3 deletions tests/Database/DatabasePostgresSchemaGrammarTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1093,21 +1093,21 @@ public function testDropAllTablesEscapesTableNames()
{
$statement = $this->getGrammar()->compileDropAllTables(['alpha', 'beta', 'gamma']);

$this->assertSame('drop table "alpha","beta","gamma" cascade', $statement);
$this->assertSame('drop table "alpha", "beta", "gamma" cascade', $statement);
}

public function testDropAllViewsEscapesTableNames()
{
$statement = $this->getGrammar()->compileDropAllViews(['alpha', 'beta', 'gamma']);

$this->assertSame('drop view "alpha","beta","gamma" cascade', $statement);
$this->assertSame('drop view "alpha", "beta", "gamma" cascade', $statement);
}

public function testDropAllTypesEscapesTableNames()
{
$statement = $this->getGrammar()->compileDropAllTypes(['alpha', 'beta', 'gamma']);

$this->assertSame('drop type "alpha","beta","gamma" cascade', $statement);
$this->assertSame('drop type "alpha", "beta", "gamma" cascade', $statement);
}

public function testCompileColumns()
Expand Down
Loading