package siprp.update.updates;

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

/**
 *
 * @author fpalma
 */
public class V9_1_To_V9_2
		implements siprp.update.Update
{
	
	public V9_1_To_V9_2()
	{
	}
	
	public String []listChanges()
	{
		return new String[]{
		                    "Soft-delete nas tabelas de higiene e saude"
		                    };
	}
	
	public double getStartVersion()
	{
		return 9.1;
	}
	
	public double getEndVersion()
	{
		return 9.2;
	}
	
	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_area add column deleted_date timestamp;" +
					"alter table hs_equipamento_medico add column deleted_date timestamp;" +
					"alter table hs_legislacao add column deleted_date timestamp;" +
					"alter table hs_legislacao_categoria add column deleted_date timestamp;" +
					"alter table hs_medida add column deleted_date timestamp;" +
					"alter table hs_normalizacao add column deleted_date timestamp;" +
					"alter table hs_posto add column deleted_date timestamp;" +
					"alter table hs_relatorio_medida add column deleted_date timestamp;" +
					"alter table hs_relatorio_risco add column deleted_date timestamp;" +
					"alter table hs_risco add column deleted_date timestamp;" +
					"alter table hs_risco_tema add column deleted_date timestamp;"
		);
		executer.executeQuery( update );
	}
	
	public String toString()
	{
		return "v" + getStartVersion() + " para v" + getEndVersion();
	}
}
