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_1_6;
016    
017    import com.liferay.portal.kernel.upgrade.UpgradeProcess;
018    import com.liferay.portal.kernel.upgrade.util.DateUpgradeColumnImpl;
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_1_6.util.SocialActivityTable;
023    import com.liferay.portal.upgrade.v5_1_6.util.SocialRelationTable;
024    import com.liferay.portal.upgrade.v5_1_6.util.SocialRequestTable;
025    
026    /**
027     * @author Brian Wing Shun Chan
028     */
029    public class UpgradeSocial extends UpgradeProcess {
030    
031            @Override
032            protected void doUpgrade() throws Exception {
033    
034                    // SocialActivity
035    
036                    UpgradeColumn createDateColumn = new DateUpgradeColumnImpl(
037                            "createDate");
038                    UpgradeColumn modifiedDateColumn = new DateUpgradeColumnImpl(
039                            "modifiedDate");
040    
041                    UpgradeTable upgradeTable = UpgradeTableFactoryUtil.getUpgradeTable(
042                            SocialActivityTable.TABLE_NAME, SocialActivityTable.TABLE_COLUMNS,
043                            createDateColumn);
044    
045                    upgradeTable.setCreateSQL(SocialActivityTable.TABLE_SQL_CREATE);
046                    upgradeTable.setIndexesSQL(SocialActivityTable.TABLE_SQL_ADD_INDEXES);
047    
048                    upgradeTable.updateTable();
049    
050                    // SocialRelation
051    
052                    upgradeTable = UpgradeTableFactoryUtil.getUpgradeTable(
053                            SocialRelationTable.TABLE_NAME, SocialRelationTable.TABLE_COLUMNS,
054                            createDateColumn);
055    
056                    upgradeTable.setCreateSQL(SocialRelationTable.TABLE_SQL_CREATE);
057                    upgradeTable.setIndexesSQL(SocialRelationTable.TABLE_SQL_ADD_INDEXES);
058    
059                    upgradeTable.updateTable();
060    
061                    // SocialRequest
062    
063                    upgradeTable = UpgradeTableFactoryUtil.getUpgradeTable(
064                            SocialRequestTable.TABLE_NAME, SocialRequestTable.TABLE_COLUMNS,
065                            createDateColumn, modifiedDateColumn);
066    
067                    upgradeTable.setCreateSQL(SocialRequestTable.TABLE_SQL_CREATE);
068                    upgradeTable.setIndexesSQL(SocialRequestTable.TABLE_SQL_ADD_INDEXES);
069    
070                    upgradeTable.updateTable();
071            }
072    
073    }