1
22
23 package com.liferay.portal.upgrade.v4_3_0;
24
25 import com.liferay.portal.model.impl.UserIdMapperImpl;
26 import com.liferay.portal.upgrade.UpgradeException;
27 import com.liferay.portal.upgrade.UpgradeProcess;
28 import com.liferay.portal.upgrade.util.DefaultUpgradeTableImpl;
29 import com.liferay.portal.upgrade.util.PKUpgradeColumnImpl;
30 import com.liferay.portal.upgrade.util.SwapUpgradeColumnImpl;
31 import com.liferay.portal.upgrade.util.UpgradeColumn;
32 import com.liferay.portal.upgrade.util.UpgradeTable;
33 import com.liferay.portal.upgrade.v4_3_0.util.AvailableMappersUtil;
34
35 import java.sql.Types;
36
37 import org.apache.commons.logging.Log;
38 import org.apache.commons.logging.LogFactory;
39
40
46 public class UpgradeUserIdMapper extends UpgradeProcess {
47
48 public void upgrade() throws UpgradeException {
49 _log.info("Upgrading");
50
51 try {
52 doUpgrade();
53 }
54 catch (Exception e) {
55 throw new UpgradeException(e);
56 }
57 }
58
59 protected void doUpgrade() throws Exception {
60
61
63 UpgradeColumn upgradeUserIdColumn = new SwapUpgradeColumnImpl(
64 "userId", new Integer(Types.VARCHAR),
65 AvailableMappersUtil.getUserIdMapper());
66
67 UpgradeTable upgradeTable = new DefaultUpgradeTableImpl(
68 UserIdMapperImpl.TABLE_NAME, UserIdMapperImpl.TABLE_COLUMNS,
69 new PKUpgradeColumnImpl("userIdMapperId", false),
70 upgradeUserIdColumn);
71
72 upgradeTable.setCreateSQL(UserIdMapperImpl.TABLE_SQL_CREATE);
73
74 upgradeTable.updateTable();
75 }
76
77 private static Log _log = LogFactory.getLog(UpgradeUserIdMapper.class);
78
79 }