diff --git a/src/java/com/samskivert/depot/PersistenceContext.java b/src/java/com/samskivert/depot/PersistenceContext.java index 8ec6fce..311e12a 100644 --- a/src/java/com/samskivert/depot/PersistenceContext.java +++ b/src/java/com/samskivert/depot/PersistenceContext.java @@ -244,7 +244,12 @@ public class PersistenceContext public void registerMigration ( Class type, SchemaMigration migration) { - getRawMarshaller(type).registerMigration(migration); + DepotMarshaller marshaller = getRawMarshaller(type); + if (marshaller.isInitialized()) { + throw new IllegalStateException( + "Migrations must be registered before initializeRepositories() is called."); + } + marshaller.registerMigration(migration); } /**