Uploaded image for project: 'Red Hat 3scale API Management'
  1. Red Hat 3scale API Management
  2. THREESCALE-10602

Upgrade to 2.14 fails due to a failed database migration

XMLWordPrintable

    • 3
    • False
    • None
    • False
    • Not Started
    • Not Started
    • Not Started
    • Not Started
    • Not Started
    • Not Started

      Expected behaviour

      When upgrading from 2.13 to 2.14 all migrations should take care of known issues that will cause schema migrations to fail and result in a successful migration.

      Current behaviour

      When upgrading from 2.13 to 2.14 the changes introduced by THREESCALE-9655 cause a migration to fail.

      Migrating to AddPrimaryKeyToFeaturesPlans (REDACTED)
      == REDACTED AddPrimaryKeyToFeaturesPlans: migrating =====================
      [strong_migrations] DANGER: No lock timeout set
      -- execute("ALTER TABLE features_plans ADD CONSTRAINT features_plans_pk PRIMARY KEY (plan_id, feature_id)")
      rake aborted!
      StandardError: An error has occurred, this and all later migrations canceled:
      
      PG::UniqueViolation: ERROR:  could not create unique index "features_plans_pk"
      DETAIL:  Key (plan_id, feature_id)=(32, 13) is duplicated.
      

      The cause of this is clear in the logs and is in fact due to a bug on the API that allowed duplicate entries of the same record to exist. That bug has in fact been fixed indirectly by the introduction of a primary key on this table but the migration does not take care of the fact the bug existed and would have gotten databases into a broken state in the first place.

              Unassigned Unassigned
              rhn-support-keprice Kevin Price
              Lluis Cavalle Lluis Cavalle
              Votes:
              0 Vote for this issue
              Watchers:
              13 Start watching this issue

                Created:
                Updated:
                Resolved: