/*
 * V7_9_To_V8_0.java
 *
 * Created on December 19, 2007, 3:12 PM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package siprp.update.updates;

import com.evolute.utils.Singleton;
import com.evolute.utils.db.DBManager;
import com.evolute.utils.db.Executer;
import com.evolute.utils.sql.Assignment;
import com.evolute.utils.sql.Field;

/**
 *
 * @author fpalma
 */
public class V7_9_To_V8_0
		implements siprp.update.Update
{
	
	/**
	 * Creates a new instance of V7_9_To_V8_0
	 */
	public V7_9_To_V8_0()
	{
	}
	
	public String []listChanges()
	{
		return new String[]{ "Alterar tabela dos ecds"};
	}
	
	public double getStartVersion()
	{
		return 7.9;
	}
	
	public double getEndVersion()
	{
		return 8.0;
	}
	
	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 trabalhadores_ecd DROP CONSTRAINT trabalhadores_ecd_trabalhadores_ecds_id_fkey;" );
		executer.executeQuery( update );
		update = 
			new com.evolute.utils.sql.Update( 
				"ALTER TABLE trabalhadores_ecd DROP trabalhadores_ecds_id;" );
		executer.executeQuery( update );
		update = 
			new com.evolute.utils.sql.Update( 
				"ALTER TABLE trabalhadores_ecd DROP CONSTRAINT trabalhadores_ecg_prestador_id_fkey;" );
		executer.executeQuery( update );
		update = 
			new com.evolute.utils.sql.Update( 
				"ALTER TABLE trabalhadores_ecd DROP prestador_id;" );
		executer.executeQuery( update );
	}
	
	public String toString()
	{
		return "v" + getStartVersion() + " para v" + getEndVersion();
	}
}
