Skip to content

Commit

Permalink
Merge branch '6.x-multischema_support' of https://github.com/raymondt…
Browse files Browse the repository at this point in the history
…ri/framework into raymondtri-6.x-multischema_support
  • Loading branch information
taylorotwell committed Nov 11, 2019
2 parents 5e10c01 + 7bf252e commit 8b4ef9f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
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 @@ -233,23 +233,23 @@ public function compileDropAllTypes($types)
/**
* Compile the SQL needed to retrieve all table names.
*
* @param string $schema
* @param string|array $schema
* @return string
*/
public function compileGetAllTables($schema)
{
return "select tablename from pg_catalog.pg_tables where schemaname = '{$schema}'";
return "select tablename from pg_catalog.pg_tables where schemaname in ('".implode("','", (array) $schema)."')";
}

/**
* Compile the SQL needed to retrieve all view names.
*
* @param string $schema
* @param string|array $schema
* @return string
*/
public function compileGetAllViews($schema)
{
return "select viewname from pg_catalog.pg_views where schemaname = '{$schema}'";
return "select viewname from pg_catalog.pg_views where schemaname in ('".implode("','", (array) $schema)."')";
}

/**
Expand Down
6 changes: 3 additions & 3 deletions src/Illuminate/Database/Schema/PostgresBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function dropAllTables()
{
$tables = [];

$excludedTables = ['spatial_ref_sys'];
$excludedTables = $this->connection->getConfig('excluded_drop_tables') ?? ['spatial_ref_sys'];

foreach ($this->getAllTables() as $row) {
$row = (array) $row;
Expand Down Expand Up @@ -105,7 +105,7 @@ public function dropAllTypes()
public function getAllTables()
{
return $this->connection->select(
$this->grammar->compileGetAllTables($this->connection->getConfig('schema'))
$this->grammar->compileGetAllTables((array) $this->connection->getConfig('schema'))
);
}

Expand All @@ -117,7 +117,7 @@ public function getAllTables()
protected function getAllViews()
{
return $this->connection->select(
$this->grammar->compileGetAllViews($this->connection->getConfig('schema'))
$this->grammar->compileGetAllViews((array) $this->connection->getConfig('schema'))
);
}

Expand Down

0 comments on commit 8b4ef9f

Please sign in to comment.