From e3fe3e61acc0951b281db08f53892fb4b31a4015 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lu=C3=ADs=20Flores?= Date: Tue, 15 May 2007 14:28:48 +0000 Subject: [PATCH] no message git-svn-id: https://svn.coded.pt/svn/SIPRP@378 bb69d46d-e84e-40c8-a05a-06db0d633741 --- trunk/siprp/update/updates/V7_6_To_V7_7.java | 70 ++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 trunk/siprp/update/updates/V7_6_To_V7_7.java diff --git a/trunk/siprp/update/updates/V7_6_To_V7_7.java b/trunk/siprp/update/updates/V7_6_To_V7_7.java new file mode 100644 index 00000000..0ad6f81e --- /dev/null +++ b/trunk/siprp/update/updates/V7_6_To_V7_7.java @@ -0,0 +1,70 @@ +/* + * V7_6_To_V7_7.java + * + * Created on May 15, 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 lflores + */ +public class V7_6_To_V7_7 + implements siprp.update.Update +{ + + /** + * Creates a new instance of V7_6_To_V7_7 + */ + public V7_6_To_V7_7() + { + } + + public String []listChanges() + { + return new String[]{ "Alterar tabela dos exames e criar tabela exames_portaria" }; + } + + public double getStartVersion() + { + return 7.6; + } + + public double getEndVersion() + { + return 7.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 exames ADD fo BYTEA;" ); + executer.executeQuery( update ); + update = new com.evolute.utils.sql.Update( + "CREATE TABLE exames_portaria ( id SERIAL NOT NULL, portaria VARCHAR(255) NOT NULL, data_entrada TIMESTAMP DEFAULT CURRENT_TIME NOT NULL, PRIMARY KEY( id ) );" ); + executer.executeQuery( update ); + com.evolute.utils.sql.Insert insert = + new com.evolute.utils.sql.Insert( "ficha_aptidao_portaria", + new Assignment[]{ new Assignment( new Field( "portaria" ), "Portaria n. 299/2007, de 16 de Mar\u00e7o" ) } ); + executer.executeQuery( insert ); + } + + public String toString() + { + return "v" + getStartVersion() + " para v" + getEndVersion(); + } +}