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.BaseUpgradeLastPublishDate;
018    
019    /**
020     * @author Levente Hud??k
021     */
022    public class UpgradeLastPublishDate extends BaseUpgradeLastPublishDate {
023    
024            @Override
025            protected void doUpgrade() throws Exception {
026                    upgradeAssetCategoriesAdmin();
027                    upgradeBlogs();
028                    upgradeDocumentLibrary();
029                    upgradeLayoutsAdmin();
030                    upgradeMessageBoards();
031                    upgradeMobileDeviceRules();
032                    upgradeSiteAdmin();
033            }
034    
035            protected void upgradeAssetCategoriesAdmin() throws Exception {
036                    runSQL("alter table AssetCategory add lastPublishDate DATE null");
037    
038                    updateLastPublishDates("147", "AssetCategory");
039    
040                    runSQL("alter table AssetTag add lastPublishDate DATE null");
041    
042                    updateLastPublishDates("147", "AssetTag");
043    
044                    runSQL("alter table AssetVocabulary add lastPublishDate DATE null");
045    
046                    updateLastPublishDates("147", "AssetVocabulary");
047            }
048    
049            protected void upgradeBlogs() throws Exception {
050                    runSQL("alter table BlogsEntry add lastPublishDate DATE null");
051    
052                    updateLastPublishDates("33", "BlogsEntry");
053            }
054    
055            protected void upgradeDocumentLibrary() throws Exception {
056                    runSQL("alter table DLFileEntry add lastPublishDate DATE null");
057    
058                    updateLastPublishDates("20", "DLFileEntry");
059    
060                    runSQL("alter table DLFileEntryType add lastPublishDate DATE null");
061    
062                    updateLastPublishDates("20", "DLFileEntryType");
063    
064                    runSQL("alter table DLFileShortcut add lastPublishDate DATE null");
065    
066                    updateLastPublishDates("20", "DLFileShortcut");
067    
068                    runSQL("alter table DLFileVersion add lastPublishDate DATE null");
069    
070                    updateLastPublishDates("20", "DLFileVersion");
071    
072                    runSQL("alter table DLFolder add lastPublishDate DATE null");
073    
074                    updateLastPublishDates("20", "DLFolder");
075    
076                    runSQL("alter table Repository add lastPublishDate DATE null");
077    
078                    updateLastPublishDates("20", "Repository");
079    
080                    runSQL("alter table RepositoryEntry add lastPublishDate DATE null");
081    
082                    updateLastPublishDates("20", "RepositoryEntry");
083            }
084    
085            protected void upgradeLayoutsAdmin() throws Exception {
086                    runSQL("alter table Layout add lastPublishDate DATE null");
087    
088                    updateLastPublishDates("88", "Layout");
089    
090                    runSQL("alter table LayoutFriendlyURL add lastPublishDate DATE null");
091    
092                    updateLastPublishDates("88", "LayoutFriendlyURL");
093            }
094    
095            protected void upgradeMessageBoards() throws Exception {
096                    runSQL("alter table MBBan add lastPublishDate DATE null");
097    
098                    updateLastPublishDates("19", "MBBan");
099    
100                    runSQL("alter table MBCategory add lastPublishDate DATE null");
101    
102                    updateLastPublishDates("19", "MBCategory");
103    
104                    runSQL("alter table MBDiscussion add lastPublishDate DATE null");
105    
106                    updateLastPublishDates("19", "MBDiscussion");
107    
108                    runSQL("alter table MBMessage add lastPublishDate DATE null");
109    
110                    updateLastPublishDates("19", "MBMessage");
111    
112                    runSQL("alter table MBThread add lastPublishDate DATE null");
113    
114                    updateLastPublishDates("19", "MBThread");
115    
116                    runSQL("alter table MBThreadFlag add lastPublishDate DATE null");
117    
118                    updateLastPublishDates("19", "MBThreadFlag");
119            }
120    
121            protected void upgradeMobileDeviceRules() throws Exception {
122                    runSQL("alter table MDRAction add lastPublishDate DATE null");
123    
124                    updateLastPublishDates("178", "MDRAction");
125    
126                    runSQL("alter table MDRRule add lastPublishDate DATE null");
127    
128                    updateLastPublishDates("178", "MDRRule");
129    
130                    runSQL("alter table MDRRuleGroup add lastPublishDate DATE null");
131    
132                    updateLastPublishDates("178", "MDRRuleGroup");
133    
134                    runSQL(
135                            "alter table MDRRuleGroupInstance add lastPublishDate DATE null");
136    
137                    updateLastPublishDates("178", "MDRRuleGroupInstance");
138            }
139    
140            protected void upgradeSiteAdmin() throws Exception {
141                    runSQL("alter table Team add lastPublishDate DATE null");
142    
143                    updateLastPublishDates("134", "Team");
144            }
145    
146    }