Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Each object that is changed should be in its own method.  Check to make sure if it has been done before.  See if it should even run.  There are a few cases

Object typeCheckDescriptionExample
New tableCheck if going to current version of aboveThis is not that important since it is only called from current version


Code Block
 GrouperDdl.V32.getVersion() <= ddlVersionBean.getBuildingToVersion();


New column,view, comment, index, foreign key, etcCheck if going to current version of aboveThis is important since the method is called from two places,
  1. when the table/object is created
  2. when this version is upgraded


Code Block
GrouperDdl.V32.getVersion() <= ddlVersionBean.getBuildingToVersion();


Changed view

This is complicated and requires multiple steps (example in 2.5)

  1. In previous version, if building to that version, create some view with same name.
  2. In current version, if not building from scratch, drop the view
  3. in current version, if building to current version of above, create the view
If you dont create the view with temp name in previous version, then ddlutils wont detect that it needs to drop it

previous version:

Code Block
GrouperDdl.
V31
V32.getVersion() 
<=
> ddlVersionBean.getBuildingToVersion();

building from scratch:

Code Block
ddlVersionBean.getBuildingFromVersion() <= 0


Update statementCheck to see if needs to updateYou can check by version number or see if you can find the table in the object model (isTableNew)


Code Block
    Table groupTable = GrouperDdlUtils.ddlutilsFindTable(database, Group.TABLE_GROUPER_GROUPS, true);
    boolean enabledColumnIsNew = false;
    
    if (groupTable != null) {
      enabledColumnIsNew = null == GrouperDdlUtils.ddlutilsFindColumn(groupTable, Group.COLUMN_ENABLED, false);
    }