Closed
Description
Laravel Version
10.35.0
PHP Version
8.2.13
Database Driver & Version
PostgreSQL 15.5 for Ubuntu on amd64
Description
db:wipe
only drops regular tables, partitioned tables are not dropped in PostgreSQL. I've noticed this while running migrate:fresh
command (from RefreshDatabase
trait in tests). If some migration is creating a partitioned table without checking if it exists, running tests passes the first time but fails on every following run because the table already exists. Even if table is created with IF NOT EXISTS
migrations changing it will have the same problem.
Expected behavior would be for the partitioned tables to be removed as well.
It started happening from version 10.34.0 (#49020).
Steps To Reproduce
- Clone https://github.com/nikazooz/postgresql-partitioned-table-failed-migration and move into the folder
- Laravel Sail is installed for easy database setup so with Docker running start the containers with
vendor/bin/sail up -d
- Install dependencies with
vendor/bin/sail composer install
- Run tests with
vendor/bin/sail test
- they pass the first time. - Run tests again they fail with error
Duplicate table: 7 ERROR: relation "groups" already exists