001
014
015 package com.liferay.portal.upgrade.v6_1_1;
016
017 import com.liferay.portal.kernel.dao.jdbc.DataAccess;
018 import com.liferay.portal.kernel.upgrade.UpgradeProcess;
019 import com.liferay.portal.kernel.util.StringBundler;
020
021 import java.sql.Connection;
022 import java.sql.PreparedStatement;
023 import java.sql.ResultSet;
024
025
029 public class UpgradeLayoutSet extends UpgradeProcess {
030
031 @Override
032 protected void doUpgrade() throws Exception {
033 Connection con = null;
034 PreparedStatement ps = null;
035 ResultSet rs = null;
036
037 try {
038 con = DataAccess.getUpgradeOptimizedConnection();
039
040 StringBundler sb = new StringBundler(4);
041
042 sb.append("select Group_.groupId, Group_.liveGroupId, ");
043 sb.append("LayoutSet.layoutSetId from LayoutSet inner join ");
044 sb.append("Group_ on (LayoutSet.groupId = Group_.groupId and ");
045 sb.append("Group_.liveGroupId > 0 and LayoutSet.logo = ?)");
046
047 ps = con.prepareStatement(sb.toString());
048
049 ps.setBoolean(1, true);
050
051 rs = ps.executeQuery();
052
053 while (rs.next()) {
054 long groupId = rs.getLong("Group_.groupId");
055 long layoutSetId = rs.getLong("LayoutSet.layoutSetId");
056
057 runSQL(
058 "update LayoutSet set logoId = 0 where groupId = " +
059 groupId + " and layoutSetId = " + layoutSetId);
060 }
061 }
062 finally {
063 DataAccess.cleanUp(con, ps, rs);
064 }
065 }
066
067 }