package siprp.update.updates;

import siprp.higiene.gestao.importacao.Importador;

import com.evolute.utils.Singleton;
import com.evolute.utils.db.DBManager;
import com.evolute.utils.db.Executer;

public class V10_5_To_V10_6
		implements siprp.update.Update
{
	
	public V10_5_To_V10_6()
	{
	}
	
	public String []listChanges()
	{
		return new String[]{
		                    "Importa\u00e7\u00e3o de riscos e medidas"
		                    };
	}
	
	public double getStartVersion()
	{
		return 10.5;
	}
	
	public double getEndVersion()
	{
		return 10.6;
	}
	
	public void doUpdate()
		throws Exception
	{
		DBManager dbm = ( DBManager ) Singleton.getInstance( Singleton.DEFAULT_DBMANAGER );
		Executer executer = dbm.getSharedExecuter();
		com.evolute.utils.sql.Update update = 
			new com.evolute.utils.sql.Update( "alter table hs_medida alter column description type character varying(8192);");
		executer.executeQuery( update );
		update = new com.evolute.utils.sql.Update( "alter table hs_medida alter column requesitos_legais type character varying(8192);");
		executer.executeQuery( update );
		new Importador( executer ).importar();
	}
	
	public String toString()
	{
		return "v" + getStartVersion() + " para v" + getEndVersion();
	}
}
