Hi,
I’ve an application that use several schemas and there are some FK between them.
Is there a way to make a diff comparing several schemas at the time?
Or at least if the diff it’s done in a per schema basis is there a way to detect as difference the fks to external schemas?
PD:
I’ve searched the list and someone says something of putting ‘%’ to defaultSchema but it doesn’t seems to has any effect.
A lot of thanks in advance,
The diff support doesn’t support multiple schemas well, if the % doesn’t work I don’t know of anything else that may work. The plan is to focus on the diff tool in the 2.1 release.
Nathan
Thanks Nathan.
Two things about that:
-1-
Is there any forum post discussing new features planed for the diff tool?
For me will be very useful two or three things:
Support for multiple schemas as you said
Dependency checking with posterior ordering for changesets
Option for operation grouping on similar changesets (for example two modifycolumns of the same table)
-2-
For now one think that would help is an option to put the schema explicitly in changelog diff reporting.
This will help to do several diffs and then join them manually without having to add the schema for each operation.
I’ve looked at the code and it seems and easy one to implement. Would be accepted a patch adding such option?
Cheers,
-
There hasn’t been any forum postings on the diff tool features so far. So far it’s just been an “I’m not able to get any diff improvements in and still get 2.0 out in any reasonable time, so I’m pushing off all diff improvements” pattern in jira
-
If you submit a commit or patch with your diff change, I’ll take a look a it. One thing I struggle with regarding diffs and schemas is making sure to support all the use cases (many of which I’m sure I don’t know). There are probably more times that you don’t care about the schema in your diff output and/or want to diff two versions of the same database in different schemas, or take a snapshot in one schema and apply it to the other. I’d want to make sure support for that type of usage remains.
Depending on the extent of your changes, it may be best to use the branches/next_version branch. I haven’t merged into it from trunk for a little while, but since I’m trying to finalize the 2.0 release that branch would be safer for you to work on without worrying about affecting the 2.0 version.
Nathan
I’ve looking at the problem and I’ve seen that Liquibase diff reporter already puts the schema if it’s specified in defaultSchemaName.
Then no option is aparently needed.
Althouth I don’t now if it’s good to depend in defaultSchemaName because it seems coincidental because the schema is first read from metadata and then assigned another time with the one provided in defaultSchemaName (It seems a try to correct the fact that some dbms like mysql never return the schema in metadata)
Also I’ve take a look at why foreign keys to external schemas aren’t detected and for me seems that two conditions in JdbcDatabaseSnapshotGenerator.readForeignKeyInformation are changed:
The one that compares if (pkTable == null) discards the foreign key and the one that compares (fkTable == null) preserves the fk with a warning saying that the fk is preserved but the table won’t be diffed.
It seems that the conditions are turned, aren’t they?
Cheers,