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

db:wipe doesn't remove partitioned tables on PostgreSQL #49321

Closed
nikazooz opened this issue Dec 11, 2023 · 2 comments · Fixed by #49326
Closed

db:wipe doesn't remove partitioned tables on PostgreSQL #49321

nikazooz opened this issue Dec 11, 2023 · 2 comments · Fixed by #49326
Labels

Comments

@nikazooz
Copy link
Contributor

nikazooz commented Dec 11, 2023

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
@driesvints
Copy link
Member

cc @hafezdivandari

@hafezdivandari
Copy link
Contributor

Thanks for reporting, I sent a PR for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants