I tried turning on the logging:
log4j.logger.er.extensions.migration.ERXMigrator=DEBUG
but I don't get any log messages at all from ERXMigrator.
However, I did just find the ERXMigrator docs, and I'm not doing the
following and I'm guessing I need to?...
Because of complications with database locking, the system will not
autocreate tables and per-model rows for you, so if you are using JDBC
migration, you should create a table named _DBUpdater with the
following (approximately) create statement:
create table _dbupdater (
modelname varchar(100) not null,
version integer not null,
updatelock integer not null,
lockowner varchar(100)
)
I tried it:
log4j.logger.er.extensions.migration.ERXMigrator=DEBUG
But I don't see any debug statements from ERXMigrator.
Howeverand for each model you want to be able to migrate, you should:
insert into _dbupdater(modelname, version, updatelock,
lockowner) values ('YourModelName', -1, 0, NULL)
Be aware that not all databases are able to perform DDL operations in
a transaction. The result of this is that if a DDL operation fails,
your database may be left in an unknown state because the subsequent
rollback will fail. Version numbers only increase when each migration
completes sucessfully, so in this case, your migration version would
be left at the previous version number.
Startup migration runs in response to the
ApplicationWillFinishLaunchingNotification, so you should not access
your EO's until after that notification is complete.
ApplicationWillFinishLaunchingNotification is used instead of
ApplicationDidFinishLaunchingNotification so that the application will
not start accepting requests before migration is complete.
On Apr 14, 2009, at 9:46 PM, Mike Schrag wrote:
I would turn on debugging for the
er.extensions.migration.ERXMigrator log4j logger and see what it
says ...
ms
On Apr 14, 2009, at 10:34 PM, Jeff Schmitz wrote:
On Apr 14, 2009, at 8:28 AM, David Avendasora wrote:
Hi Jeff,
I am not currently using Migrations but, have you looked here?
http://webobjects.mdimension.com/wonder/api/index.html?er/extensions/partials/package-summary.html
Hmm, I don't really see much about the mechanics of setting up
migrations at that link.
This has an excellent overview of how to setup and use ERMigrations.
I would put the Migration Classes in the same project where your
EOModel is, but put the migration properties in the Application's
properties file. That way you can control the migration settings
on a per-application basis.
As far as the startup goes, I think you have your properties setup
incorrectly.
You are naming the model "netbracketsFW":
er.migration.modelNames=netbracketsFW
But you are calling "netbrackets"
netbrackets
.MigrationClassPrefix=com.netbrackets.migration.Netbrackets
This should be netbracketsFW.MigrationClassPrefix=...
I think I've set it up as you recommended but the migration class
still doesn't get called. In my latest try I have put everything
(EOModel, migrations class and properties) in the framework project.
# Migrations
er.migration.migrateAtStartup=true
er.migration.createTablesIfNecessary=true
er.migration.modelNames=netbracketsFW
netbracketsFW
.MigrationClassPrefix=com.netbracketsfw.migrations.NetbracketsFW
#Connection Dictionary
dbConnectURLGLOBAL=jdbc:frontbase://localhost/myDB
dbConnectUserGLOBAL=myDBUser
dbConnectPasswordGLOBAL=myPassword
----------<NetbracketsFW0.java file>---------------
package com.netbracketsfw.migrations;
import com.webobjects.eocontrol.EOEditingContext;
import com.webobjects.foundation.NSArray;
import er.extensions.migration.ERXMigrationDatabase;
import er.extensions.migration.ERXMigrationTable;
import er.extensions.migration.ERXModelVersion;
public class NetbracketsFW0 extends ERXMigrationDatabase.Migration {
It doesn't matter where the class is located as long as the class
is on the classpath somewhere (framework is on the build path).
I hope this helps!
Dave
On Apr 14, 2009, at 7:33 AM, Jeff Schmitz wrote:
Hello,
I'm trying to get migrations to run on my model that is defined
in a framework, but I'm not sure where to put the migrations
class (in the framework or my application that references the
framework) and where to put the properties related to migrations
(framework or app?). Also, what should the first part of the
below "netbrackets.MigrationClassPrefix" be named after, the
framework project or the app project? I've tried about every
different combination I can think of but can't seem to hit on the
correct setup as when I run, the database tables don't get created.
Below are how my properties are set:
# Migrations
er.migration.migrateAtStartup=true
er.migration.createTablesIfNecessary=true
er.migration.modelNames=netbracketsFW
netbrackets
.MigrationClassPrefix=com.netbrackets.migration.Netbrackets
#Connection Dictionary
dbConnectURLGLOBAL=jdbc:frontbase://localhost/myDB
dbConnectUserGLOBAL=myDBUser
dbConnectPasswordGLOBAL=myPW
thanks,
Jeff
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/webobjects%40avendasora.com
This email sent to [email protected]
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/mschrag%40mdimension.com
This email sent to [email protected]
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com
This email sent to [email protected]