001    /**
002     * Copyright (c) 2000-present 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.v7_0_0;
016    
017    import com.liferay.portal.kernel.upgrade.UpgradeProcess;
018    import com.liferay.portal.upgrade.v7_0_0.util.ShoppingCartTable;
019    import com.liferay.portal.upgrade.v7_0_0.util.ShoppingOrderItemTable;
020    import com.liferay.portal.upgrade.v7_0_0.util.ShoppingOrderTable;
021    
022    import java.sql.SQLException;
023    
024    /**
025     * @author Kenneth Chang
026     */
027    public class UpgradeShopping extends UpgradeProcess {
028    
029            @Override
030            protected void doUpgrade() throws Exception {
031                    try {
032                            runSQL("alter_column_type ShoppingCart itemIds TEXT null");
033                    }
034                    catch (SQLException sqle) {
035                            upgradeTable(
036                                    ShoppingCartTable.TABLE_NAME, ShoppingCartTable.TABLE_COLUMNS,
037                                    ShoppingCartTable.TABLE_SQL_CREATE,
038                                    ShoppingCartTable.TABLE_SQL_ADD_INDEXES);
039                    }
040    
041                    try {
042                            runSQL("alter_column_type ShoppingOrder comments TEXT null");
043                    }
044                    catch (SQLException sqle) {
045                            upgradeTable(
046                                    ShoppingOrderTable.TABLE_NAME, ShoppingOrderTable.TABLE_COLUMNS,
047                                    ShoppingOrderTable.TABLE_SQL_CREATE,
048                                    ShoppingOrderTable.TABLE_SQL_ADD_INDEXES);
049                    }
050    
051                    try {
052                            runSQL("alter_column_type ShoppingOrderItem itemId TEXT null");
053                    }
054                    catch (SQLException sqle) {
055                            upgradeTable(
056                                    ShoppingOrderItemTable.TABLE_NAME,
057                                    ShoppingOrderItemTable.TABLE_COLUMNS,
058                                    ShoppingOrderItemTable.TABLE_SQL_CREATE,
059                                    ShoppingOrderItemTable.TABLE_SQL_ADD_INDEXES);
060                    }
061            }
062    
063    }