I discovered that the model compare is somewhat broken. I'm not sure
where this got in as this was working before. Currently when comparing
two PA models (e.g. from two files) several tables are listed with a
DROP TABLE first, and then a bit later with a CREATE TABLE
If you want to reproduce this, please compare the two models I have
uploaded:
http://www.sql-workbench.net/movies_v1.0.architect
http://www.sql-workbench.net/movies_v2.0.architect
1.0 being the "older", and two tables have been added in v2.0. The
generated SQL (and Liquibase) is something like this:
DROP TABLE public.film;
[... some other statements ]
CREATE TABLE public.film (
film_id INTEGER NOT NULL,
release_year INTEGER NOT NULL,
runtime_minutes INTEGER NOT NULL,
slogan VARCHAR(50),
description TEXT,
working_title VARCHAR(50),
original_title VARCHAR(50) NOT NULL,
CONSTRAINT pk_film PRIMARY KEY (film_id)
);
Even though nothing (neither a FK nor a PK) has changed in the table
film.
The reason is that CompareSQL initialises the two TreeSet with the
nameComparator, but for the whole process to work reliably with two
models (i.e. when useUUID == true) the result from
getObjectComparator() needs to be used.
The code in the constructor currently is this:
this.sourceTableSet = new TreeSet<SQLTable>(nameComparator);
this.sourceTableSet.addAll(sourceTables);
this.targetTableSet = new TreeSet<SQLTable>(nameComparator);
this.targetTableSet.addAll(targetTables);
this.suppressSimilarities = suppressSimilarities;
this.useUUID = useUUID;
but it should be
this.useUUID = useUUID;
this.sourceTableSet = new TreeSet<SQLTable>(getObjectComparator());
this.sourceTableSet.addAll(sourceTables);
this.targetTableSet = new TreeSet<SQLTable>(getObjectComparator());
this.targetTableSet.addAll(targetTables);
this.suppressSimilarities = suppressSimilarities;
Note that assigning useUUID needs to be done before calling
getObjectComparator() the first time.
If nobody objects I'll commit this, to make the model compare work
again.
Regards
Thomas
None of us object, so feel free to commit the fix.
Thank you!
> --
> You received this message because you are subscribed to the Google Groups "Architect Developers" group.
> To post to this group, send email to architect-...@googlegroups.com.
> To unsubscribe from this group, send email to architect-develo...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/architect-developers?hl=en.
>