001    /**
002     * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.upgrade.v6_0_0;
016    
017    import com.liferay.portal.kernel.upgrade.UpgradeProcess;
018    import com.liferay.portal.upgrade.v6_0_0.util.JournalArticleTable;
019    import com.liferay.portal.upgrade.v6_0_0.util.JournalFeedTable;
020    import com.liferay.portal.upgrade.v6_0_0.util.JournalTemplateTable;
021    
022    import java.sql.SQLException;
023    
024    /**
025     * @author Zsigmond Rab
026     */
027    public class UpgradeJournal extends UpgradeProcess {
028    
029            @Override
030            protected void doUpgrade() throws Exception {
031                    try {
032                            runSQL(
033                                    "alter_column_type JournalArticle smallImageURL STRING null");
034    
035                            runSQL(
036                                    "alter_column_type JournalFeed targetLayoutFriendlyUrl " +
037                                            "VARCHAR(255) null");
038    
039                            runSQL(
040                                    "alter_column_type JournalTemplate smallImageURL STRING null");
041                    }
042                    catch (SQLException sqle) {
043                            upgradeTable(
044                                    JournalArticleTable.TABLE_NAME,
045                                    JournalArticleTable.TABLE_COLUMNS,
046                                    JournalArticleTable.TABLE_SQL_CREATE,
047                                    JournalArticleTable.TABLE_SQL_ADD_INDEXES);
048    
049                            upgradeTable(
050                                    JournalFeedTable.TABLE_NAME, JournalFeedTable.TABLE_COLUMNS,
051                                    JournalFeedTable.TABLE_SQL_CREATE,
052                                    JournalFeedTable.TABLE_SQL_ADD_INDEXES);
053    
054                            upgradeTable(
055                                    JournalTemplateTable.TABLE_NAME,
056                                    JournalTemplateTable.TABLE_COLUMNS,
057                                    JournalTemplateTable.TABLE_SQL_CREATE,
058                                    JournalTemplateTable.TABLE_SQL_ADD_INDEXES);
059                    }
060            }
061    
062    }