I found the following https://stackoverflow.com/a/9712051/61249 which is good but still too much manual labor for me. I need to recreate the views in the right order how would I go about doing that?
@dbenhur talks about the following:
To be more complete, one could figure out how to query which views depend on the table(es) you're modifying and use that query instead f enumerating view names. Gonna need to understand pg_rewrite | pg_rule to do that, I think
I am unsure what that means exactly but I'll tell you want I need and you tell me if it is possible.
I work on a rails application where I've tried to maintain the views and functions as part of the rails migrations unfortunately this became a real mess and I dumped our views and functions into separate files for each and one of those. There are two ways forward as I see it. I could either use a single file for these which makes it cumbersome but I guess the order of the DDL would be managed by pg_dump.
OR I could when I dump the views and functions also query and create a dependency tree that I later use for recreating them. The reason is that it has become too complex to do manually for just changing the name of a column in a view.
How do others maintain their DDL? Anyone ever done anything like what I want to do?