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_3_To_V9_4
		implements siprp.update.Update
{
	
	public V9_3_To_V9_4()
	{
	}
	
	public String []listChanges()
	{
		return new String[]{
		                    "Adicionados postos de trabalho relatorio"
		                    };
	}
	
	public double getStartVersion()
	{
		return 9.3;
	}
	
	public double getEndVersion()
	{
		return 9.4;
	}
	
	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(
					"create table hs_relatorio_medida_area" +
					"(" +
					"	id serial PRIMARY KEY," +
					"	description varchar(256) NOT NULL" +
					");" +
					"create table hs_relatorio_medida_posto" +
					"(" +
					"	id serial PRIMARY KEY," +
					"	description varchar(256) NOT NULL," +
					"	area_id int4 REFERENCES hs_relatorio_medida_area(id)" +
					");"
		);
		executer.executeQuery( update );
	}
	
	public String toString()
	{
		return "v" + getStartVersion() + " para v" + getEndVersion();
	}
}
