-
Notifications
You must be signed in to change notification settings - Fork 11.2k
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 migrations table from second schema #41483
Comments
Please post your @cbj4074 since you worked on this: do you have any idea here? |
|
Does it work if you try |
And this definitely worked in Laravel 8? |
No, it didn't work in Laravel 8 at all. The second schema was ignored by wipe. We used to call |
I see. Thanks for that info. I currently do not now how to solve this one. |
Absolutely; I'm happy to take a look at this, but it will probably be later today or tomorrow. |
Maybe in this line drop table should be with a schema name? Something like: |
Finally getting a chance to dig into this in earnest... As is the case with all things It doesn't look like I've touched any of the For anyone else who is interested, #36046 contains a lot of background information regarding I'm hoping to be able to propose a fix today. |
Okay, I've had a chance to assess the issue pretty thoroughly at this point. This is a complicated problem and understanding #36046 is important to ascertaining why. @abelharisov , The reason for this is rooted in the following method: framework/src/Illuminate/Database/Schema/PostgresBuilder.php Lines 139 to 148 in d10ab79
In a multi-schema configuration, if one were to run select tablename from pg_catalog.pg_tables where schemaname in ('laravel','public');
The An important point of note here is that if the That said, I don't think that would necessarily be the best or most intuitive way to handle this. Rather, framework/src/Illuminate/Database/Schema/Grammars/PostgresGrammar.php Lines 306 to 309 in 650ca87
schemaname , e.g.:
We could then target the various tables in the appropriate schemas. However, there were specific reasons for which I didn't modify that method in this way previously, which I'll do my best to articulate in a subsequent post, as I'm out of time for today. (The gist of it was that while it might be desirable in this specific scenario, it could be undesirable to use the fully-qualified object names in others, in which doing so would actually mitigate and work against the usefulness of the search_path's intent.) I'll continue to think through possible solutions to this and post another update tomorrow. |
I have a draft PR, #41541 , which should resolve this issue (and potentially other yet-to-be-identified issues of a similar nature), if anybody wants take it for a spin before I submit it for review. "Works for me!", of course. ;-) |
Thank you! |
Description:
We have two schemas in our app. During update to laravel 9 we updated postgress config.
schema
was replaced withsearch_path
with valueschemaA,schemaB
Command db:wipe clears all tables in both schemas except migrations table in second schema. We have to call this command twice to clear DB
The text was updated successfully, but these errors were encountered: