I have Postgres databases generated with Eclipse Link. Between these databases is not any change, but when I run liquibase for generating diffChangeLog, it generates changesets with dropPrimaryKey and addPrimaryKey. I don’t understand why it generates these records for all primary keys of all tables. Names, order of columns are the same for both tables.
Example of changeset
- CREATE TABLE country_translation ( country_id bigint NOT NULL, translations_id bigint NOT NULL, CONSTRAINT country_translation_pkey PRIMARY KEY (country_id, translations_id), CONSTRAINT fk_country_translation_country_id FOREIGN KEY (country_id) REFERENCES country (id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION, CONSTRAINT fk_country_translation_translations_id FOREIGN KEY (translations_id) REFERENCES translation (id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION ) WITH ( OIDS=FALSE ); ALTER TABLE country_translation OWNER TO hotels;
- CREATE TABLE country_translation ( country_id bigint NOT NULL, translations_id bigint NOT NULL, CONSTRAINT country_translation_pkey PRIMARY KEY (country_id, translations_id), CONSTRAINT fk_country_translation_country_id FOREIGN KEY (country_id) REFERENCES country (id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION, CONSTRAINT fk_country_translation_translations_id FOREIGN KEY (translations_id) REFERENCES translation (id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION ) WITH ( OIDS=FALSE ); ALTER TABLE country_translation OWNER TO hotels;
- ./liquibase \ --driver=org.postgresql.Driver \ --classpath=/home/michal2/tools/postgresql-jdbc-driver/postgresql-jdbc.jar \ --changeLogFile=changelog-hotels.xml \ --url="jdbc:postgresql://localhost/hotels" \ --username=hotels \ --password=hotels \ --defaultSchemaName=public \ --logLevel=info \ diffChangeLog \ --referenceUrl="jdbc:postgresql://localhost/hotels_liquibase" \ --referenceUsername=hotels \ --referencePassword=hotels \ --referenceDefaultSchemaName=public