Quantcast
Channel: Liquibase Forums
Viewing all articles
Browse latest Browse all 1169

Why does Liquibase want to dropPrimaryKey and addPrimaryKey?

$
0
0
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

  1. <changeSet author="michal2 (generated)" id="1436872322297-8">
            <dropPrimaryKey tableName="country_translation"/>
            <addPrimaryKey columnNames="country_id, translations_id" constraintName="country_translation_pkey" tableName="country_translation"/>
        </changeSet>
Sql of original table

  1. 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;
Sql of reference table
  1. 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 command with arguments
  1. ./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
I'm using version 3.4.0

Viewing all articles
Browse latest Browse all 1169

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>