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

PTEUDO-1991 on restore failure, create a fresh schema #356

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

drewwells
Copy link
Contributor

@drewwells drewwells commented Nov 9, 2024

When a database is partially or fully restored, we fail to
migrate to it. This is problematic as user can not easily
recover from this situation.

We will attempt to version the schema by migrating whatever
is there and starting with a new schema. In situations where
the issue is the pgdump itself, we will be creating multiple
copies of an empty schema which is cheap. In more typical
situations, we will move a partially or fully migrated schema
to another location and attempt a restore with a fresh schema.

- change restore to return sql errors rather than exit codes
- sanitize dsn emitted by restore

@drewwells drewwells marked this pull request as draft November 10, 2024 22:24
@drewwells
Copy link
Contributor Author

Dropping the database was more pain than it was worth. I think we can get by with dropping the schema BEFORE attempting a restore. The schemas will be recreated by name as the role associated with the application.

@drewwells drewwells changed the title PTEUDO-1991 drop database prior to restoring it PTEUDO-1991 drop schema prior to restoring it Nov 11, 2024
@drewwells drewwells force-pushed the restoreFails branch 3 times, most recently from cb4d9bc to 524d32a Compare November 11, 2024 23:07
@drewwells drewwells changed the title PTEUDO-1991 drop schema prior to restoring it PTEUDO-1991 on restore failure, create a fresh schema Nov 11, 2024
@drewwells drewwells marked this pull request as ready for review November 15, 2024 17:08
    When a database is partially or fully restored, we fail to
    migrate to it. This is problematic as user can not easily
    recover from this situation.

    We will attempt to version the schema by migrating whatever
    is there and starting with a new schema. In situations where
    the issue is the pgdump itself, we will be creating multiple
    copies of an empty schema which is cheap. In more typical
    situations, we will move a partially or fully migrated schema
    to another location and attempt a restore with a fresh schema.

    - change restore to return sql errors rather than exit codes
    - sanitize dsn emitted by restore
@drewwells
Copy link
Contributor Author

Kind of a lot of changes, let's do this after the 1.10.1 release

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.

1 participant