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.v5_0_0;
016    
017    import com.liferay.portal.kernel.upgrade.UpgradeProcess;
018    import com.liferay.portal.kernel.upgrade.util.TempUpgradeColumnImpl;
019    import com.liferay.portal.kernel.upgrade.util.UpgradeColumn;
020    import com.liferay.portal.kernel.upgrade.util.UpgradeTable;
021    import com.liferay.portal.kernel.upgrade.util.UpgradeTableFactoryUtil;
022    import com.liferay.portal.upgrade.v5_0_0.util.IGFolderNameColumnImpl;
023    import com.liferay.portal.upgrade.v5_0_0.util.IGFolderTable;
024    import com.liferay.portal.upgrade.v5_0_0.util.IGImageNameColumnImpl;
025    import com.liferay.portal.upgrade.v5_0_0.util.IGImageTable;
026    
027    /**
028     * @author Alexander Chow
029     */
030    public class UpgradeImageGallery extends UpgradeProcess {
031    
032            @Override
033            protected void doUpgrade() throws Exception {
034    
035                    // IGFolder
036    
037                    UpgradeColumn groupIdColumn = new TempUpgradeColumnImpl("groupId");
038    
039                    UpgradeColumn parentFolderIdColumn = new TempUpgradeColumnImpl(
040                            "parentFolderId");
041    
042                    IGFolderNameColumnImpl igFolderNameColumn = new IGFolderNameColumnImpl(
043                            groupIdColumn, parentFolderIdColumn);
044    
045                    UpgradeTable upgradeTable = UpgradeTableFactoryUtil.getUpgradeTable(
046                            IGFolderTable.TABLE_NAME, IGFolderTable.TABLE_COLUMNS,
047                            groupIdColumn, parentFolderIdColumn, igFolderNameColumn);
048    
049                    upgradeTable.updateTable();
050    
051                    // IGImage
052    
053                    UpgradeColumn imageIdColumn = new TempUpgradeColumnImpl("imageId");
054    
055                    IGImageNameColumnImpl imageNameColumn = new IGImageNameColumnImpl(
056                            imageIdColumn);
057    
058                    upgradeTable = UpgradeTableFactoryUtil.getUpgradeTable(
059                            IGImageTable.TABLE_NAME, IGImageTable.TABLE_COLUMNS, imageIdColumn,
060                            imageNameColumn);
061    
062                    upgradeTable.updateTable();
063            }
064    
065    }