Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 3.5.5
    • Fix Version/s: None
    • Component/s: None
    • Environment:

      OSX

    • Sprint:

      Description

      I'm moving a mysql database into using LB. Some of the tables have constraints on tables that no longer exist. This caused "generateChangeLog" to emit a mystery error like so,

          $ liquibase  --changeLogFile f.xml --url "$DBI" generateChangeLog 
          Unexpected error running Liquibase: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
      

      I found that the following change allows generateChangeLog to complete.

      $ git diff
      diff --git a/liquibase-core/src/main/java/liquibase/change/ColumnConfig.java b/liquibase-core/src/main/java/liquibase/change/ColumnConfig.java
      index 144980b49..8ef52837f 100644
      --- a/liquibase-core/src/main/java/liquibase/change/ColumnConfig.java
      +++ b/liquibase-core/src/main/java/liquibase/change/ColumnConfig.java
      @@ -143,6 +143,10 @@ public class ColumnConfig extends AbstractLiquibaseSerializable {
                           if ((fk.getForeignKeyColumns() != null) && (fk.getForeignKeyColumns().size() == 1) && fk
                               .getForeignKeyColumns().get(0).getName().equals(getName())) {
                               constraints.setForeignKeyName(fk.getName());
      +                        if(fk.getPrimaryKeyColumns().isEmpty()) {
      +                            System.err.println("WARNING AN EMPTY SET OF PRIMARY KEY CONSTRAINTS!!! Table: "+table.getName()+" pkc:"+fk);
      +                            continue;
      +                        }
                               constraints.setReferences(fk.getPrimaryKeyTable().getName() +
                                   "(" +
                                   fk.getPrimaryKeyColumns().get(0).getName() +
      

        Attachments

          Activity

            People

            • Reporter:
              rherrmann Robert Herrmann
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: