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

[11.x] Fix dumping migrations table with schema or prefixed name #52098

Merged
merged 2 commits into from
Jul 15, 2024

Conversation

hafezdivandari
Copy link
Contributor

@hafezdivandari hafezdivandari commented Jul 12, 2024

Alternative to #52076

Dump command uses hasMigrationTable() method to determine if the migrations table exists before dumping its data, this methods call Schema::hasTable() under the hood which handles the table's prefix and schema name on PostgreSQL.

This PR fixes 2 related problems:

  1. Makes sure the migrations table name used on hasMigrationTable() is without prefix, otherwise the table name will get prefixed twice and not be found.
  2. On PostgreSQL, it makes sure that the dump command respects the schema name the same way that Schema::hasTable() does; Otherwise we are checking if migrations table exists within the search_path and dump it from default schema instead!

Copy link

Thanks for submitting a PR!

Note that draft PR's are not reviewed. If you would like a review, please mark your pull request as ready for review in the GitHub user interface.

Pull requests that are abandoned in draft may be closed due to inactivity.

@hafezdivandari hafezdivandari changed the title [11.x] Test: Fix dump with schema and prefixed migrations table [11.x] Fix dumping migrations table with schema or prefixed name Jul 12, 2024
@hafezdivandari hafezdivandari marked this pull request as ready for review July 12, 2024 22:31
@taylorotwell taylorotwell merged commit 435098a into laravel:11.x Jul 15, 2024
12 of 28 checks passed
@hafezdivandari hafezdivandari deleted the 11.x-dump-schema-prefix branch July 16, 2024 01:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants