@Override
  protected void doUpgrade() throws Exception {

    // IGFolder

    UpgradeColumn groupIdColumn = new TempUpgradeColumnImpl("groupId");

    UpgradeColumn parentFolderIdColumn = new TempUpgradeColumnImpl("parentFolderId");

    IGFolderNameColumnImpl igFolderNameColumn =
        new IGFolderNameColumnImpl(groupIdColumn, parentFolderIdColumn);

    UpgradeTable upgradeTable =
        UpgradeTableFactoryUtil.getUpgradeTable(
            IGFolderTable.TABLE_NAME,
            IGFolderTable.TABLE_COLUMNS,
            groupIdColumn,
            parentFolderIdColumn,
            igFolderNameColumn);

    upgradeTable.updateTable();

    // IGImage

    UpgradeColumn imageIdColumn = new TempUpgradeColumnImpl("imageId");

    IGImageNameColumnImpl imageNameColumn = new IGImageNameColumnImpl(imageIdColumn);

    upgradeTable =
        UpgradeTableFactoryUtil.getUpgradeTable(
            IGImageTable.TABLE_NAME, IGImageTable.TABLE_COLUMNS, imageIdColumn, imageNameColumn);

    upgradeTable.updateTable();
  }
示例#2
0
  protected void doUpgrade() throws Exception {

    // WikiNode

    UpgradeColumn upgradeGroupIdColumn =
        new SwapUpgradeColumnImpl("groupId", AvailableMappersUtil.getGroupIdMapper());

    UpgradeColumn upgradeUserIdColumn =
        new SwapUpgradeColumnImpl(
            "userId", new Integer(Types.VARCHAR), AvailableMappersUtil.getUserIdMapper());

    PKUpgradeColumnImpl upgradePKColumn = new PKUpgradeColumnImpl("nodeId", true);

    UpgradeTable upgradeTable =
        UpgradeTableFactoryUtil.getUpgradeTable(
            WikiNodeTable.TABLE_NAME,
            WikiNodeTable.TABLE_COLUMNS,
            upgradePKColumn,
            upgradeGroupIdColumn,
            upgradeUserIdColumn);

    upgradeTable.setCreateSQL(WikiNodeTable.TABLE_SQL_CREATE);

    upgradeTable.updateTable();

    ValueMapper nodeIdMapper = upgradePKColumn.getValueMapper();

    AvailableMappersUtil.setWikiNodeIdMapper(nodeIdMapper);

    UpgradeColumn upgradeNodeIdColumn = new SwapUpgradeColumnImpl("nodeId", nodeIdMapper);

    // WikiPage

    UpgradeColumn upgradeTitleColumn = new TempUpgradeColumnImpl("title");

    WikiPageIdUpgradeColumnImpl upgradePageIdColumn =
        new WikiPageIdUpgradeColumnImpl(upgradeNodeIdColumn, upgradeTitleColumn);

    UpgradeColumn upgradePageResourcePrimKeyColumn =
        new WikiPageResourcePrimKeyUpgradeColumnImpl(upgradePageIdColumn);

    upgradeTable =
        UpgradeTableFactoryUtil.getUpgradeTable(
            WikiPageTable.TABLE_NAME,
            WikiPageTable.TABLE_COLUMNS,
            upgradeNodeIdColumn,
            upgradeTitleColumn,
            upgradePageIdColumn,
            upgradePageResourcePrimKeyColumn,
            upgradeUserIdColumn);

    upgradeTable.setCreateSQL(WikiPageTable.TABLE_SQL_CREATE);

    upgradeTable.updateTable();

    ValueMapper pageIdMapper = upgradePageIdColumn.getValueMapper();

    AvailableMappersUtil.setWikiPageIdMapper(pageIdMapper);
  }
  protected void upgradeTable(
      String tableName, Object[][] tableColumns, String sqlCreate, String[] sqlAddIndexes)
      throws Exception {

    UpgradeTable upgradeTable = UpgradeTableFactoryUtil.getUpgradeTable(tableName, tableColumns);

    upgradeTable.setCreateSQL(sqlCreate);
    upgradeTable.setIndexesSQL(sqlAddIndexes);

    upgradeTable.updateTable();
  }
示例#4
0
  protected void doUpgrade() throws Exception {

    // Company

    String[] webIds = WebIdUtil.getWebIds();

    for (String webId : webIds) {
      runSQL("delete from Image where imageId = '" + webId + "'");

      runSQL("delete from Image where imageId = '" + webId + ".wbmp'");

      runSQL("update Image set imageId = '" + webId + "' where imageId = '" + webId + ".png'");
    }

    // Image

    PKUpgradeColumnImpl upgradePKColumn =
        new PKUpgradeColumnImpl("imageId", new Integer(Types.VARCHAR), true);

    ImageTextUpgradeColumnImpl upgradeTextColumn = new ImageTextUpgradeColumnImpl(upgradePKColumn);

    ImageTypeUpgradeColumnImpl upgradeTypeColumn =
        new ImageTypeUpgradeColumnImpl(upgradeTextColumn);

    ImageHeightUpgradeColumnImpl upgradeHeightColumn =
        new ImageHeightUpgradeColumnImpl(upgradeTextColumn);

    ImageWidthUpgradeColumnImpl upgradeWidthColumn =
        new ImageWidthUpgradeColumnImpl(upgradeTextColumn);

    ImageSizeUpgradeColumnImpl upgradeSizeColumn =
        new ImageSizeUpgradeColumnImpl(upgradeTextColumn);

    UpgradeTable upgradeTable =
        UpgradeTableFactoryUtil.getUpgradeTable(
            ImageTable.TABLE_NAME,
            ImageTable.TABLE_COLUMNS,
            upgradePKColumn,
            upgradeTextColumn,
            upgradeTypeColumn,
            upgradeHeightColumn,
            upgradeWidthColumn,
            upgradeSizeColumn);

    upgradeTable.setCreateSQL(ImageTable.TABLE_SQL_CREATE);

    upgradeTable.updateTable();

    ValueMapper imageIdMapper = new DefaultPKMapper(upgradePKColumn.getValueMapper());

    AvailableMappersUtil.setImageIdMapper(imageIdMapper);
  }
  protected void doUpgrade() throws Exception {
    try {
      runSQL("alter_column_type CalEvent remindBy INTEGER");
    } catch (Exception e) {

      // CalEvent

      UpgradeTable upgradeTable =
          UpgradeTableFactoryUtil.getUpgradeTable(
              CalEventTable.TABLE_NAME, CalEventTable.TABLE_COLUMNS);

      upgradeTable.setCreateSQL(CalEventTable.TABLE_SQL_CREATE);
      upgradeTable.setIndexesSQL(CalEventTable.TABLE_SQL_ADD_INDEXES);

      upgradeTable.updateTable();
    }
  }
  @Override
  protected void doUpgrade() throws Exception {
    try {
      runSQL("alter_column_type ResourceAction name VARCHAR(255) null");
    } catch (Exception e) {

      // Resource

      UpgradeTable upgradeTable =
          UpgradeTableFactoryUtil.getUpgradeTable(
              ResourceActionTable.TABLE_NAME, ResourceActionTable.TABLE_COLUMNS);

      upgradeTable.setCreateSQL(ResourceActionTable.TABLE_SQL_CREATE);
      upgradeTable.setIndexesSQL(ResourceActionTable.TABLE_SQL_ADD_INDEXES);

      upgradeTable.updateTable();
    }
  }
  protected void upgradeTable(
      String tableName,
      Object[][] tableColumns,
      String createSQL,
      String[] indexesSQL,
      UpgradeColumn... upgradeColumns)
      throws Exception {

    try (LoggingTimer loggingTimer = new LoggingTimer(tableName)) {
      UpgradeTable upgradeTable =
          UpgradeTableFactoryUtil.getUpgradeTable(tableName, tableColumns, upgradeColumns);

      upgradeTable.setCreateSQL(createSQL);
      upgradeTable.setIndexesSQL(indexesSQL);

      upgradeTable.updateTable();
    }
  }
  protected void upgradeTable(String tableName, Object[][] tableColumns) throws Exception {

    UpgradeTable upgradeTable = UpgradeTableFactoryUtil.getUpgradeTable(tableName, tableColumns);

    upgradeTable.updateTable();
  }
  protected void doUpgrade() throws Exception {

    // JournalArticle

    UpgradeColumn upgradeCompanyIdColumn =
        new SwapUpgradeColumnImpl(
            "companyId", new Integer(Types.VARCHAR), AvailableMappersUtil.getCompanyIdMapper());

    UpgradeColumn upgradeGroupIdColumn =
        new SwapUpgradeColumnImpl("groupId", AvailableMappersUtil.getGroupIdMapper());

    UpgradeColumn upgradeUserIdColumn =
        new SwapUpgradeColumnImpl(
            "userId", new Integer(Types.VARCHAR), AvailableMappersUtil.getUserIdMapper());

    UpgradeColumn upgradeApprovedByUserIdColumn =
        new SwapUpgradeColumnImpl(
            "approvedByUserId", new Integer(Types.VARCHAR), AvailableMappersUtil.getUserIdMapper());

    JournalArticlePKUpgradeColumnImpl upgradeArticlePKColumn =
        new JournalArticlePKUpgradeColumnImpl(upgradeCompanyIdColumn, upgradeGroupIdColumn);

    UpgradeColumn upgradeArticleResourcePrimKeyColumn =
        new JournalArticleResourcePrimKeyUpgradeColumnImpl(upgradeArticlePKColumn);

    UpgradeColumn upgradeArticleIdColumn = new TempUpgradeColumnImpl("articleId");

    UpgradeColumn upgradeVersionColumn =
        new TempUpgradeColumnImpl("version", new Integer(Types.DOUBLE));

    UpgradeColumn upgradeStructureIdColumn = new TempUpgradeColumnImpl("structureId");

    UpgradeColumn upgradeContentColumn =
        new JournalArticleContentUpgradeColumnImpl(
            upgradeCompanyIdColumn,
            upgradeGroupIdColumn,
            upgradeArticleIdColumn,
            upgradeVersionColumn,
            upgradeStructureIdColumn,
            AvailableMappersUtil.getImageIdMapper());

    UpgradeTable upgradeTable =
        UpgradeTableFactoryUtil.getUpgradeTable(
            JournalArticleTable.TABLE_NAME,
            JournalArticleTable.TABLE_COLUMNS,
            upgradeCompanyIdColumn,
            upgradeGroupIdColumn,
            upgradeUserIdColumn,
            upgradeApprovedByUserIdColumn,
            upgradeArticlePKColumn,
            upgradeArticleResourcePrimKeyColumn,
            upgradeArticleIdColumn,
            upgradeVersionColumn,
            upgradeStructureIdColumn,
            upgradeContentColumn);

    upgradeTable.setCreateSQL(JournalArticleTable.TABLE_SQL_CREATE);
    upgradeTable.setIndexesSQL(JournalArticleTable.TABLE_SQL_ADD_INDEXES);

    upgradeTable.updateTable();

    ValueMapper articleIdMapper = new DefaultPKMapper(upgradeArticlePKColumn.getValueMapper());

    AvailableMappersUtil.setJournalArticleIdMapper(articleIdMapper);

    // JournalStructure

    PKUpgradeColumnImpl upgradeStructurePKColumn =
        new JournalStructurePKUpgradeColumnImpl(upgradeCompanyIdColumn, upgradeGroupIdColumn);

    UpgradeColumn upgradeXSDColumn = new JournalStructureXSDUpgradeColumnImpl();

    upgradeTable =
        UpgradeTableFactoryUtil.getUpgradeTable(
            JournalStructureTable.TABLE_NAME,
            JournalStructureTable.TABLE_COLUMNS,
            upgradeCompanyIdColumn,
            upgradeGroupIdColumn,
            upgradeStructurePKColumn,
            upgradeUserIdColumn,
            upgradeXSDColumn);

    upgradeTable.setCreateSQL(JournalStructureTable.TABLE_SQL_CREATE);
    upgradeTable.setIndexesSQL(JournalStructureTable.TABLE_SQL_ADD_INDEXES);

    upgradeTable.updateTable();

    ValueMapper structureIdMapper = new DefaultPKMapper(upgradeStructurePKColumn.getValueMapper());

    AvailableMappersUtil.setJournalStructureIdMapper(structureIdMapper);

    // JournalTemplate

    PKUpgradeColumnImpl upgradeTemplatePKColumn =
        new JournalTemplatePKUpgradeColumnImpl(upgradeCompanyIdColumn, upgradeGroupIdColumn);

    UpgradeColumn upgradeTemplateIdColumn = new TempUpgradeColumnImpl("templateId");

    UpgradeColumn upgradeXSLColumn =
        new JournalTemplateXSLUpgradeColumnImpl(upgradeTemplateIdColumn);

    UpgradeColumn upgradeSmallImageIdColumn =
        new JournalTemplateSmallImageIdUpgradeColumnImpl(
            upgradeCompanyIdColumn,
            upgradeGroupIdColumn,
            upgradeTemplatePKColumn,
            AvailableMappersUtil.getImageIdMapper());

    upgradeTable =
        UpgradeTableFactoryUtil.getUpgradeTable(
            JournalTemplateTable.TABLE_NAME,
            JournalTemplateTable.TABLE_COLUMNS,
            upgradeCompanyIdColumn,
            upgradeGroupIdColumn,
            upgradeTemplatePKColumn,
            upgradeUserIdColumn,
            upgradeTemplateIdColumn,
            upgradeXSLColumn,
            upgradeSmallImageIdColumn);

    upgradeTable.setCreateSQL(JournalTemplateTable.TABLE_SQL_CREATE);
    upgradeTable.setIndexesSQL(JournalTemplateTable.TABLE_SQL_ADD_INDEXES);

    upgradeTable.updateTable();

    ValueMapper templateIdMapper = new DefaultPKMapper(upgradeTemplatePKColumn.getValueMapper());

    AvailableMappersUtil.setJournalTemplateIdMapper(templateIdMapper);

    // JournalContentSearch

    PropsUtil.set(PropsKeys.JOURNAL_SYNC_CONTENT_SEARCH_ON_STARTUP, "true");
  }
示例#10
0
  protected void doUpgrade() throws Exception {

    // ShoppingCategory

    UpgradeColumn upgradeGroupIdColumn =
        new SwapUpgradeColumnImpl("groupId", AvailableMappersUtil.getGroupIdMapper());

    UpgradeColumn upgradeUserIdColumn =
        new SwapUpgradeColumnImpl(
            "userId", new Integer(Types.VARCHAR), AvailableMappersUtil.getUserIdMapper());

    PKUpgradeColumnImpl upgradePKColumn = new PKUpgradeColumnImpl("categoryId", true);

    UpgradeTable upgradeTable =
        UpgradeTableFactoryUtil.getUpgradeTable(
            ShoppingCategoryTable.TABLE_NAME,
            ShoppingCategoryTable.TABLE_COLUMNS,
            upgradePKColumn,
            upgradeGroupIdColumn,
            upgradeUserIdColumn);

    upgradeTable.setCreateSQL(ShoppingCategoryTable.TABLE_SQL_CREATE);

    upgradeTable.updateTable();

    ValueMapper categoryIdMapper = new DefaultPKMapper(upgradePKColumn.getValueMapper());

    AvailableMappersUtil.setShoppingCategoryIdMapper(categoryIdMapper);

    UpgradeColumn upgradeParentCategoryIdColumn =
        new SwapUpgradeColumnImpl("parentCategoryId", categoryIdMapper);

    upgradeTable =
        UpgradeTableFactoryUtil.getUpgradeTable(
            ShoppingCategoryTable.TABLE_NAME,
            ShoppingCategoryTable.TABLE_COLUMNS,
            upgradeParentCategoryIdColumn);

    upgradeTable.updateTable();

    UpgradeColumn upgradeCategoryIdColumn =
        new SwapUpgradeColumnImpl("categoryId", categoryIdMapper);

    // ShoppingItem

    upgradePKColumn = new PKUpgradeColumnImpl("itemId", true);

    upgradeTable =
        UpgradeTableFactoryUtil.getUpgradeTable(
            ShoppingItemTable.TABLE_NAME,
            ShoppingItemTable.TABLE_COLUMNS,
            upgradePKColumn,
            upgradeCategoryIdColumn,
            upgradeUserIdColumn);

    upgradeTable.setCreateSQL(ShoppingItemTable.TABLE_SQL_CREATE);

    upgradeTable.updateTable();

    ValueMapper itemIdMapper = upgradePKColumn.getValueMapper();

    AvailableMappersUtil.setShoppingItemIdMapper(itemIdMapper);

    UpgradeColumn upgradeItemIdColumn = new SwapUpgradeColumnImpl("itemId", itemIdMapper);

    // ShoppingItemField

    upgradeTable =
        UpgradeTableFactoryUtil.getUpgradeTable(
            ShoppingItemTable.TABLE_NAME,
            ShoppingItemTable.TABLE_COLUMNS,
            new PKUpgradeColumnImpl("itemFieldId", false),
            upgradeItemIdColumn);

    upgradeTable.setCreateSQL(ShoppingItemTable.TABLE_SQL_CREATE);

    upgradeTable.updateTable();

    // ShoppingItemPrice

    upgradeTable =
        UpgradeTableFactoryUtil.getUpgradeTable(
            ShoppingItemPriceTable.TABLE_NAME,
            ShoppingItemPriceTable.TABLE_COLUMNS,
            new PKUpgradeColumnImpl("itemPriceId", false),
            upgradeItemIdColumn);

    upgradeTable.setCreateSQL(ShoppingItemPriceTable.TABLE_SQL_CREATE);

    upgradeTable.updateTable();

    // ShoppingOrder

    upgradePKColumn = new PKUpgradeColumnImpl("orderId", new Integer(Types.VARCHAR), true);

    upgradeTable =
        UpgradeTableFactoryUtil.getUpgradeTable(
            ShoppingOrderTable.TABLE_NAME,
            ShoppingOrderTable.TABLE_COLUMNS,
            upgradePKColumn,
            upgradeGroupIdColumn,
            upgradeUserIdColumn);

    upgradeTable.setCreateSQL(ShoppingOrderTable.TABLE_SQL_CREATE);

    upgradeTable.updateTable();

    ValueMapper orderIdMapper = upgradePKColumn.getValueMapper();

    UpgradeColumn upgradeOrderIdColumn =
        new SwapUpgradeColumnImpl("orderId", new Integer(Types.VARCHAR), orderIdMapper);

    // ShoppingOrderItem

    UpgradeColumn upgradeCartItemIdColumn = new ShoppingCartItemIdUpgradeColumnImpl(itemIdMapper);

    upgradeTable =
        UpgradeTableFactoryUtil.getUpgradeTable(
            ShoppingOrderItemTable.TABLE_NAME,
            ShoppingOrderItemTable.TABLE_COLUMNS,
            new PKUpgradeColumnImpl("orderItemId", false),
            upgradeOrderIdColumn,
            upgradeCartItemIdColumn);

    upgradeTable.setCreateSQL(ShoppingOrderItemTable.TABLE_SQL_CREATE);

    upgradeTable.updateTable();

    // ShoppingCart

    UpgradeColumn upgradeItemIdsColumn = new ShoppingCartItemIdsUpgradeColumnImpl(itemIdMapper);

    upgradeTable =
        UpgradeTableFactoryUtil.getUpgradeTable(
            ShoppingCartTable.TABLE_NAME,
            ShoppingCartTable.TABLE_COLUMNS,
            new PKUpgradeColumnImpl("cartId", new Integer(Types.VARCHAR), false),
            upgradeGroupIdColumn,
            upgradeUserIdColumn,
            upgradeItemIdsColumn);

    upgradeTable.setCreateSQL(ShoppingCartTable.TABLE_SQL_CREATE);

    upgradeTable.updateTable();

    // ShoppingCoupon

    UpgradeColumn upgradeLimitCategoriesColumn =
        new ShoppingCouponLimitCategoriesUpgradeColumnImpl(categoryIdMapper);

    upgradeTable =
        UpgradeTableFactoryUtil.getUpgradeTable(
            ShoppingCouponTable.TABLE_NAME,
            ShoppingCouponTable.TABLE_COLUMNS,
            new PKUpgradeColumnImpl("couponId", new Integer(Types.VARCHAR), false),
            upgradeGroupIdColumn,
            upgradeUserIdColumn,
            upgradeLimitCategoriesColumn);

    upgradeTable.setCreateSQL(ShoppingCouponTable.TABLE_SQL_CREATE);

    upgradeTable.updateTable();
  }