michaelsogos / pg-diff

PostgreSQL schema and data comparing tool
MIT License
170 stars 17 forks source link

compare content of two schemas with different names #20

Open blaluc opened 4 years ago

blaluc commented 4 years ago

Is it possible to compare the DB1.schemaA with DB2.schemaB? In other words if two schemas on two different databases have different names but are supposed to contains the same tables, etc. is it possible to perform the comparison? How to configure the mapping in this scenario?

michaelsogos commented 4 years ago

Hi @blaluc ,

If i understood well, the purpose of this tool is exaclty what you intend. I mean, no matter if database objects are in the same database but with a different schema (other than "public") or in different database.

To configure it you should follow the documentation, in there you will find a JSON.

In our experience we use it for different databases, i never used it to compare different schema on same database. (that should be exactly what you ask).

Did i helped you?

blaluc commented 4 years ago

I read the json config, but I still don't understand how to configure the following scenario: I have the source db with its connections params. I have the target db with other connections params. ...so far so good, the documentation i clear.

Now I want to compare the schema named 'dev' on the source db with the schema named 'test' on the target. Where should I specify the two schema names?

In the options/schemaNamespace/namespaces node I see a flat list of schema names. How can I declare the mapping of the schema 'dev' on the source to the schema 'test' of the target?

michaelsogos commented 4 years ago

Hi @blaluc

Sorry, I misunderstood your use case. Actually it's not supported. It is like you want to compare two classes in different namespace or package. It is essentially an logical error; in any case, how should I recognize if two table having same name but in different schema must be compared? Just in case you have to consider that there are many potential unwanted comparison that will produce of course a wrong sql patch.

In any case I'd like to investigate further about this feature.