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

How do you detect unused tables and columns? #366

Open
ysangkok opened this issue Aug 12, 2024 · 2 comments
Open

How do you detect unused tables and columns? #366

ysangkok opened this issue Aug 12, 2024 · 2 comments

Comments

@ysangkok
Copy link
Contributor

By using pg_dump --schema-only, I can get schemas for prod and local. Then, I nuke my local and have Orville recreate it with the autoMigration. But since Orville doesn't create columns at the right column index, I now have to sort fields within each table of the dump and then fix the trailing comma. That's a lot of work. It would be nice if Orville provided some tips on how to detect unused columns.

@jlavelle
Copy link
Member

jlavelle commented Aug 13, 2024

See #368 for the fields part. Even if we don't merge that for some reason, it has the code you'd need to list the fields as all of the required functionality is part of the exposed API. Actually it uses some helper functions internal to the AutoMigration module, but nothing that can't be re-implemented using the exposed API.

We could do something similar for tables using pgClassTable. It would just involve getting a set of ordinary tables and comparing it to the tables in your SchemaItem list.

@jlavelle
Copy link
Member

I ended up closing that #368 because I think we should have a more robust solution that covers all of the differences between the Orville-managed schema and what's in the database.

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

No branches or pull requests

2 participants