001    /**
002     * Copyright (c) 2000-2012 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
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    }