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

Make Tobira work with PostgreSQL schemas other than public #664

Merged
merged 3 commits into from
Jan 18, 2023

Conversation

LukasKalbertodt
Copy link
Member

Fixes #635

This implements what I described in this comment. See commits for further information.

@LukasKalbertodt LukasKalbertodt added the changelog:admin Changes primarily for admins label Jan 17, 2023
docs/docs/setup/requirements.md Outdated Show resolved Hide resolved
Tobira should be able to run inside different schemas as well.
The old version would fail in some situations when the db user was not
allowed to delete the schema. We don't want to delete it anyway, but
just everything in it. So doing exactly that is more straight forward
anyway.

Unfortunately, it's a bit more involved as we have to list all objects
to be deleted. We do this by using `information_schema` but also
`pg_catalog`, unfortunately. The latter is not standard SQL and can
potentially change in future versions. Though those tables have changed
very little in the last few years. Our queries are likely to still
work in future versions of PostgreSQL. And this is just one helper
sub-command anyway.

The other question is: does this indeed delete all kinds of objects in
the DB? Well, probably not, but I'm fairly sure it deletes all the ones
that our migrations create. I tested this a couple of times, running
`db migrate` and `db clear` back to back and all works as expected. I
tested with PG10 and PG15. I also checked in a GUI tool and didn't see
any remaining objects of interest.
@LukasKalbertodt LukasKalbertodt merged commit cc0b380 into elan-ev:master Jan 18, 2023
@LukasKalbertodt LukasKalbertodt deleted the fix-pg-schemas branch January 18, 2023 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog:admin Changes primarily for admins
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tobira only works with "public" schema
2 participants