git-svn-id: https://svn.coded.pt/svn/SIPRP@1256 bb69d46d-e84e-40c8-a05a-06db0d633741

lxbfYeaa
Tiago Simão 16 years ago
parent 89a1455ae6
commit 72fe94026b

@ -200,11 +200,11 @@ public class Main implements com.evolute.utils.ui.window.Connector
// UnicodeChecker.setUseDoubleSlash( true );
Singleton.setInstance( Singleton.DEFAULT_DBMANAGER, dbm );
Updater.getInstance().executeUpdate(true, true, UpdateList.UPDATE_LIST);
StatementExecuterFactory.initialize(
new DBStatementExecuter( dbm.getSharedExecuter(this) ) );
Updater.getInstance().executeUpdate(true, true, UpdateList.UPDATE_LIST);
new ORMInitializer().initializeORM( url, user, passwd );
Singleton.setInstance( Singleton.TODAY, new Date() );

@ -9,7 +9,8 @@ package siprp.clientes;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.util.Hashtable;
import java.util.HashMap;
import java.util.Map;
import javax.swing.JLabel;
import javax.swing.JPanel;
@ -174,7 +175,7 @@ public class ContactoPanel extends JPanel
}
String names[] = contacto.getFieldNames();
Hashtable hash = new Hashtable();
Map<String, Object> hash = new HashMap<String, Object>();
ComponentController.save( names, hash, components );
contacto.setHashData( hash );
return contacto;

@ -31,6 +31,7 @@ import siprp.update.updates.V11_8_To_V11_9;
import siprp.update.updates.V11_9_To_V12_0;
import siprp.update.updates.V12_0_To_V12_1;
import siprp.update.updates.V12_1_To_V12_2;
import siprp.update.updates.V12_2_To_V12_3;
import siprp.update.updates.V6_1_To_V7_0;
import siprp.update.updates.V7_0_To_V7_2;
import siprp.update.updates.V7_2_To_V7_4;
@ -96,8 +97,8 @@ public class UpdateList
new V11_3_To_V11_4(), new V11_4_To_V11_5(),
new V11_5_To_V11_6(), new V11_6_To_V11_7(),
new V11_7_To_V11_8(), new V11_8_To_V11_9(),
new V11_9_To_V12_0(),new V12_0_To_V12_1(),
new V12_1_To_V12_2()
new V11_9_To_V12_0(), new V12_0_To_V12_1(),
new V12_1_To_V12_2(),new V12_2_To_V12_3()
};
//
// protected static Executer EXECUTER;

@ -0,0 +1,45 @@
package siprp.update.updates;
import com.evolute.module.updater.AbstractUpdate;
import com.evolute.utils.db.PSQLSequenceUtils;
import com.evolute.utils.sql.Update;
public class V12_2_To_V12_3 extends AbstractUpdate
{
public V12_2_To_V12_3()
{
super( 12.2, 12.3, "A corrigir chaves primarias" );
}
@Override
public void doUpdate() throws Exception
{
fixIdColumn( "avisos", "id" );
fixIdColumn( "contactos", "id" );
fixIdColumn( "empresas", "id" );
fixIdColumn( "estabelecimentos", "id" );
fixIdColumn( "exames", "id" );
fixIdColumn( "exames_perfis", "id" );
fixIdColumn( "historico_estabelecimento", "id" );
fixIdColumn( "marcacoes_empresa", "id" );
fixIdColumn( "marcacoes_estabelecimento", "id" );
fixIdColumn( "marcacoes_tecnicos_hst", "id" );
fixIdColumn( "marcacoes_trabalhador", "id" );
fixIdColumn( "medicos", "id" );
fixIdColumn( "prt_grupos_protocolo", "id" );
fixIdColumn( "prt_tipos_elementos_protocolo", "id" );
fixIdColumn( "tipos_exames_comp", "id" );
fixIdColumn( "trabalhadores", "id" );
}
private void fixIdColumn( String columnName, String idField ) throws Exception
{
executeQuery( new Update(
"create sequence " + columnName + "_" + idField + "_seq; " +
"alter table " + columnName + " alter column " + idField + " set default nextval(('" + columnName + "_" + idField + "_seq'::text)::regclass); "
) );
PSQLSequenceUtils.fixSequence( columnName, idField );
}
}
Loading…
Cancel
Save