For the general case, the solution problem is not theoretical.
Simple example from
create table foo (id serial, description text);
AT
create table foo (id serial, username varchar(50));
It is possible to achieve both by renaming with changing data type, and by deleting and adding a column. The results at the data level will be different, and it is the developer who must decide what has changed here.
You can see what basically has changed in the database, you can pg_dump -s data scheme dump and see the diff . Quite a working idea is also the night crowns, which takes a dump of the scheme from the production master database and saves it to git . So there is a history of real changes in the combat base.