1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
13   */
14  
15  package com.liferay.portal.upgrade.v5_1_6;
16  
17  import com.liferay.portal.kernel.upgrade.UpgradeProcess;
18  import com.liferay.portal.kernel.upgrade.util.DateUpgradeColumnImpl;
19  import com.liferay.portal.kernel.upgrade.util.UpgradeColumn;
20  import com.liferay.portal.kernel.upgrade.util.UpgradeTable;
21  import com.liferay.portal.kernel.upgrade.util.UpgradeTableFactoryUtil;
22  import com.liferay.portal.upgrade.v5_1_6.util.SocialActivityTable;
23  import com.liferay.portal.upgrade.v5_1_6.util.SocialRelationTable;
24  import com.liferay.portal.upgrade.v5_1_6.util.SocialRequestTable;
25  
26  /**
27   * <a href="UpgradeSocial.java.html"><b><i>View Source</i></b></a>
28   *
29   * @author Brian Wing Shun Chan
30   */
31  public class UpgradeSocial extends UpgradeProcess {
32  
33      protected void doUpgrade() throws Exception {
34  
35          // SocialActivity
36  
37          UpgradeColumn createDateColumn = new DateUpgradeColumnImpl(
38              "createDate");
39          UpgradeColumn modifiedDateColumn = new DateUpgradeColumnImpl(
40              "modifiedDate");
41  
42          UpgradeTable upgradeTable = UpgradeTableFactoryUtil.getUpgradeTable(
43              SocialActivityTable.TABLE_NAME, SocialActivityTable.TABLE_COLUMNS,
44              createDateColumn);
45  
46          upgradeTable.setCreateSQL(SocialActivityTable.TABLE_SQL_CREATE);
47  
48          upgradeTable.updateTable();
49  
50          // SocialRelation
51  
52          upgradeTable = UpgradeTableFactoryUtil.getUpgradeTable(
53              SocialRelationTable.TABLE_NAME, SocialRelationTable.TABLE_COLUMNS,
54              createDateColumn);
55  
56          upgradeTable.setCreateSQL(SocialRelationTable.TABLE_SQL_CREATE);
57  
58          upgradeTable.updateTable();
59  
60          // SocialRequest
61  
62          upgradeTable = UpgradeTableFactoryUtil.getUpgradeTable(
63              SocialRequestTable.TABLE_NAME, SocialRequestTable.TABLE_COLUMNS,
64              createDateColumn, modifiedDateColumn);
65  
66          upgradeTable.setCreateSQL(SocialRequestTable.TABLE_SQL_CREATE);
67  
68          upgradeTable.updateTable();
69      }
70  
71  }