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

[8.x] Changing the dump and restore method for a PostgreSQL database #34293

Merged
merged 1 commit into from
Oct 2, 2020

Conversation

d-stephane
Copy link

@d-stephane d-stephane commented Sep 11, 2020

PR related to issue #34281

@driesvints driesvints changed the title Changing the dump and restore method for a PostgreSQL database [8.x] Changing the dump and restore method for a PostgreSQL database Sep 11, 2020
@@ -73,7 +73,7 @@ protected function schemaState(Connection $connection)
*/
protected function path(Connection $connection)
{
return tap($this->option('path') ?: database_path('schema/'.$connection->getName().'-schema.sql'), function ($path) {
return tap($this->option('path') ?: database_path('schema/'.$connection->getName().'-schema.dump'), function ($path) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The result obtained with ** pg_dump -Fc ** is not SQL therefore not readable like classic SQL ...

@taylorotwell
Copy link
Member

I wasn't able to reproduce this issue so don't feel comfortable changing the code at this time. Need more feedback from Pgsql users as to specifically what is happening.

@d-stephane
Copy link
Author

No problem

@mfn
Copy link
Contributor

mfn commented Sep 12, 2020

PgSQL user here.

I see no problem with the PR and in fact would also argue it's more idiomatic to use -Fc (performance) and not name it .sql, because it simply isn't.

@taylorotwell taylorotwell reopened this Oct 2, 2020
@taylorotwell taylorotwell merged commit fcf175b into laravel:8.x Oct 2, 2020
@taylorotwell
Copy link
Member

@mfn @d-stephane ever since this PR Postgres schema dump has been totally broken to be honest.

First, the migration data is never stored in the dump because this entire method no longer works:

image

It doesn't work because obviously this binary dump doesn't include SELECT statements it can parse out. This causes the subsequent migrations to break because Laravel thinks it always needs to reload the state because the migrations table is empty.

@taylorotwell
Copy link
Member

I have created a new PR to try to fix this: #35018

@d-stephane
Copy link
Author

I just tested, it works very well :)

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

3 participants