1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
13   */
14  
15  package com.liferay.portal.upgrade.v6_0_0;
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.v6_0_0.util.JournalArticleTable;
21  import com.liferay.portal.upgrade.v6_0_0.util.JournalFeedTable;
22  import com.liferay.portal.upgrade.v6_0_0.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  }