Skip to content

DatabaseRefresh with Postgres Multiple Schemas is not dropping all tables #36100

Closed
@jhjm32087

Description

@jhjm32087
  • Laravel Version: 8.25.0
  • PHP Version: 8.0
  • Database Driver & Version:
  • Postgres 13.1 & Latest

Description:

I have a Postgres database with two schemas and during Unit Testing, with the RefreshDatabase Trait. It's dropping all tables correctly, but only to the default connection schema and leaving the rest of the tables.

This seems related to PostgresBuilder.php calling the getAllTables function and only using $this->connection->getConfig('schema') while only allows/filters the default connection schema.

image
image
image

Steps To Reproduce:

`CREATE SCHEMA s1;
CREATE SCHEMA s2;

SET SEARCH_PATH TO s1;

CREATE table test1
(
id INT
);

SET SEARCH_PATH TO s2;

CREATE table test2
(
id INT
);`

php artisan db:wipe

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions