If we rename an object or attribute there isn't a way to know that 'foo' becomes 'bar' unless (i) we have a discovery algorithm (that can't be precise -- e.g. rename a table, rename a column and add another column) or (ii) tell explicitly that 'foo' is now 'bar'. AFAICS (ii) is the right way to solve this problem.
OP should explicity inform in configuration file that 'foo' becomes 'bar'. One idea is a 'transform' section that contains option=value pairs. Each pair has option (object or attribute -- goal is identify the object) and a value (indeed two values separated by comma). An example:
[transform]
table=foo, bar ; ALTER TABLE foo RENAME to bar
attribute=teste.a, teste.b ; ALTER TABLE teste RENAME COLUMN a TO b
schema=adm, rh ; ALTER SCHEMA adm RENAME TO rh
table=adm.foo, rh.foo ; ALTER TABLE adm.foo SET SCHEMA TO rh
function=adm.foo(integer), bar ; ALTER FUNCTION adm.foo(integer) RENAME TO bar
schema could be omitted for objects?
disallow different schemas unless in 'schema' option?
If we rename an object or attribute there isn't a way to know that 'foo' becomes 'bar' unless (i) we have a discovery algorithm (that can't be precise -- e.g. rename a table, rename a column and add another column) or (ii) tell explicitly that 'foo' is now 'bar'. AFAICS (ii) is the right way to solve this problem.
OP should explicity inform in configuration file that 'foo' becomes 'bar'. One idea is a 'transform' section that contains option=value pairs. Each pair has option (object or attribute -- goal is identify the object) and a value (indeed two values separated by comma). An example:
[transform] table=foo, bar ; ALTER TABLE foo RENAME to bar attribute=teste.a, teste.b ; ALTER TABLE teste RENAME COLUMN a TO b schema=adm, rh ; ALTER SCHEMA adm RENAME TO rh table=adm.foo, rh.foo ; ALTER TABLE adm.foo SET SCHEMA TO rh function=adm.foo(integer), bar ; ALTER FUNCTION adm.foo(integer) RENAME TO bar
It should support:
RENAME TO / SET SCHEMA
RENAME
MOVE SCHEMA