Hi all,
I am trying to implement Migrations in an existing Application.
I followed the instructions in this page:
http://webobjects.mdimension.com/hudson/job/Wonder/javadoc/er/extensions/migration/package-summary.html
and this one
http://webobjects.mdimension.com/hudson/job/Wonder/javadoc/er/extensions/migration/ERXMigration.html
I think the steps are:
*1. Modify properties file:*
# Migrations
er.migration.migrateAtStartup=true
er.migration.createTablesIfNecessary=true
er.migration.modelNames=DInAdminEOModel
er.extensions.migration.ERXMigration.useDatabaseSpecificMigrations=true
DInAdminEOModel.InitialMigrationVersion=1
DInAdminEOModel.MigrationClassPrefix=com.toracom.app.migration.DInAdminEOModel
*2. Create class **com.toracom.app.migration.DInAdminEOModel1.java*
*
*
/////// BEGIN CLASS
package com.toracom.app.migration;
import com.webobjects.eoaccess.EOAdaptorChannel;
import com.webobjects.eoaccess.EOModel;
import com.webobjects.eocontrol.EOEditingContext;
import com.webobjects.foundation.NSArray;
import er.extensions.migration.ERXMigration;
import er.extensions.migration.ERXModelVersion;
public class DInAdminEOModel1 extends ERXMigration {
public NSArray<ERXModelVersion> modelDependencies() {
returnnull;
}
@Override
public void upgrade(EOEditingContext editingContext, EOAdaptorChannel channel, EOModel model) throws Throwable {
}
@Override
public void downgrade(EOEditingContext editingContext,EOAdaptorChannel channel, EOModel model) throws Throwable {
// TODO Auto-generated method stub
}
}
////// END CLASS
*3. Create DInAdminEOModel1_Postgresql_Upgrade.migration file*
ALTER TABLE parametros ADD COLUMN modulo_cfdivault_habilitado varchar(5);
UDPATE parametros SET modulo_cfdivault_habilitado = 'false';
ALTER TABLE parametros ALTER COLUMN modulo_cfdivault_habilitado SET NOT NULL;
When I run my application never get the SQL code executed. In the Application class I load a Parametros entity but I get the following error
Apr 06 11:38:11 dinadmin[55559] DEBUG NSLog - evaluateExpression: <com.webobjects.jdbcadaptor.PostgresqlExpression: "SELECT DISTINCT t0.directorio_raiz_procesamiento_cfd, t0.email_formato, t0.encoding_archivo_fuente, t0.encoding_escritura_cfd, t0.encoding_escritura_div_sol, t0.encoding_escritura_xml_co, t0.encoding_escritura_xml_impresion, t0.encoding_lectura_jaxb, t0.encoding_obtencion_co, t0.encoding_trans_co, t0.fh, t0.fhc, t0.formato_fecha_dhtmlxgrid, t0.formato_numero_registro_bd, t0.formato_numero_registro_bd_corto, t0.fsh, t0.fshnm, t0.iva, t0.logs_debug, t0.logs_path, t0.logs_stdout, t0.metodo_impresion, t0.modulo_cfdivault_habilitado, t0.moneda_id, t0.nd, t0.ne <http://t0.ne/>, t0.nm, t0.nombre_aplicacion, t0.np <http://t0.np/>, t0.ntc, t0.parametros_id, t0.retraso_daemon, t0.rfc_fisica, t0.rfc_moral, t0.sistema_inicializado, t0.url_birt_viewer, t0.version_comprobante FROM parametros t0" withBindings: >
Apr 06 11:38:11 dinadmin[55559] DEBUG NSLog - === Rollback Internal Transaction
ERROR: column t0.modulo_cfdivault_habilitado does not existat org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1608)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1343)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:194)
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:451)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:336)
Because the modulo_cfdivault_habilitado column does not exist, so the migration's file is never executed.
Am I missing something, maybe a missing Framework?
*
*
Thanks in advance.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden <mailto:email@hidden>)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden <mailto:email@hidden>