package com.liferay.lms.upgrade;

import java.io.IOException;
import java.sql.SQLException;
import com.liferay.portal.kernel.dao.db.DB;
import com.liferay.portal.kernel.dao.db.DBFactoryUtil;
import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil;
import com.liferay.portal.kernel.upgrade.UpgradeProcess;

public class UpgradeVersion_4_2_0 extends UpgradeProcess {
	private static Log log = LogFactoryUtil.getLog(UpgradeVersion_4_2_0.class);
	
	
	public int getThreshold() {
		return 420;
	}
	
	protected void doUpgrade() throws Exception {
		log.info("Actualizando version a 4.1.0");

		String updateCourseResult = "ALTER TABLE `lms_courseresult` ADD COLUMN `registrationDate` DATETIME NULL AFTER `passed`;";
	
		DB db = DBFactoryUtil.getDB();
		log.info("Alter table lms_courseresult -->> Add registrationDate");
		try {
			db.runSQL(updateCourseResult);
		} catch (IOException | SQLException e) {
			e.printStackTrace();
		} 	
	}
	
}
@@ -613,16 +613,55 @@
 a 4.
-1
+2
 .0%22);%0A%0A
+%09%0A%09%09DB db = DBFactoryUtil.getDB();%09%0A%09%09%0A
 %09%09St
@@ -780,46 +780,153 @@
 sed%60
-;%22;%0A%09%0A%09%09DB db = DBFactoryUtil.getDB();
+, %22%0A%09%09%09%09+ %22ADD COLUMN %60companyId%60 BIGINT(20) NULL AFTER %60extraData%60, %22%0A%09%09%09%09+ %22ADD COLUMN %60userModifiedId%60 BIGINT(20) NULL AFTER %60companyId%60;%22;%0A%09%09
 %0A%09%09l
@@ -972,32 +972,41 @@
 -%3E%3E Add 
-registrationDate
+companyId, userModifiedId
 %22);%0A%09%09tr

Upgrade para columnas en tabla courseresult