package siprp.update.updates;

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

public class V10_6_To_V10_7
		implements siprp.update.Update
{
	
	public V10_6_To_V10_7()
	{
	}
	
	public String []listChanges()
	{
		return new String[]{
		                    "alteracao de tamanho maximo em campos de descricao"
		                    };
	}
	
	public double getStartVersion()
	{
		return 10.6;
	}
	
	public double getEndVersion()
	{
		return 10.7;
	}
	
	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_risco alter column description type varchar(8192); " + 
				"alter table hs_relatorio_risco alter column description type varchar(8192); " +
				"alter table hs_normalizacao alter column descricao type varchar(8192); " +
				"alter table hs_relatorio_normalizacao alter column descricao type varchar(8192); " +
				"alter table hs_legislacao alter column description type varchar(8192); " +
				"alter table hs_relatorio_legislacao alter column descricao type varchar(8192); " +
				"alter table hs_area alter column description type varchar(1024); " +
				"alter table hs_relatorio_area alter column description type varchar(1024); " +
				"alter table hs_posto alter column description type varchar(1024); " +
				"alter table hs_relatorio_posto alter column description type varchar(1024); "
		);
		executer.executeQuery( update );
	}
	
	public String toString()
	{
		return "v" + getStartVersion() + " para v" + getEndVersion();
	}
}
