1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   *
13   */
14  
15  package com.liferay.portal.upgrade.v5_2_8;
16  
17  import com.liferay.portal.kernel.upgrade.UpgradeProcess;
18  import com.liferay.portal.kernel.upgrade.util.UpgradeTable;
19  import com.liferay.portal.kernel.upgrade.util.UpgradeTableFactoryUtil;
20  import com.liferay.portal.upgrade.v5_2_8.util.JournalArticleTable;
21  import com.liferay.portal.upgrade.v5_2_8.util.JournalFeedTable;
22  import com.liferay.portal.upgrade.v5_2_8.util.JournalTemplateTable;
23  
24  /**
25   * <a href="UpgradeJournal.java.html"><b><i>View Source</i></b></a>
26   *
27   * @author Zsigmond Rab
28   */
29  public class UpgradeJournal extends UpgradeProcess {
30  
31      protected void doUpgrade() throws Exception {
32          try {
33              runSQL(
34                  "alter_column_type JournalArticle smallImageURL STRING null");
35          }
36          catch (Exception e) {
37              UpgradeTable upgradeTable = UpgradeTableFactoryUtil.getUpgradeTable(
38                  JournalArticleTable.TABLE_NAME,
39                  JournalArticleTable.TABLE_COLUMNS);
40  
41              upgradeTable.setCreateSQL(JournalArticleTable.TABLE_SQL_CREATE);
42  
43              upgradeTable.updateTable();
44          }
45  
46          try {
47              runSQL(
48                  "alter_column_type JournalFeed targetLayoutFriendlyUrl " +
49                  "VARCHAR(255) null");
50          }
51          catch (Exception e) {
52              UpgradeTable upgradeTable = UpgradeTableFactoryUtil.getUpgradeTable(
53                  JournalFeedTable.TABLE_NAME, JournalFeedTable.TABLE_COLUMNS);
54  
55              upgradeTable.setCreateSQL(JournalFeedTable.TABLE_SQL_CREATE);
56  
57              upgradeTable.updateTable();
58          }
59  
60          try {
61              runSQL(
62                  "alter_column_type JournalTemplate smallImageURL STRING null");
63          }
64          catch (Exception e) {
65              UpgradeTable upgradeTable = UpgradeTableFactoryUtil.getUpgradeTable(
66                  JournalTemplateTable.TABLE_NAME,
67                  JournalTemplateTable.TABLE_COLUMNS);
68  
69              upgradeTable.setCreateSQL(JournalTemplateTable.TABLE_SQL_CREATE);
70  
71              upgradeTable.updateTable();
72          }
73      }
74  
75  }