This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hi! I've been coding to support migrations in our application, and it seems to me like the interfaces are all connected to the actual migration(s) and not to the model at all. I can't find an obvious way to get the current version of the DB, without loading a dll with migrations and creating a migrator. Is this correct? Do you plan on releasing some more documentation on this subject, or maybe some examples on how to use migrations through code?
|
|
|
Hello Thomas, We've been a bit surprised (in a pleasant way) by the number of people wanting to use migrations in their own applications -- we anticipated that people would use the migrations API to build migrations, then run them from Visual Studio or lsmigrate. Consequently, we don't have any samples or documentation about hosting the migrations framework and running migrations from your own code. This is evidently something we need to remedy now that we have a better idea of how people want to use this stuff. Regarding your specific question about getting the current database version: yes, you would need to create a Migrator and call its CurrentVersion() method. This in turn requires you to have a migrations source that you can pass into Migrator.CreateMigrator: this could be a migrations DLL, or you could create a dummy IMigrationLoader (that just yields an empty sequence) and pass that into CreateMigrator, or I think you could just pass null if you're only ever planning to call CurrentVersion(). We realise this is a bit of an anomaly -- had we realised that hosting migrations was going to be popular we would have put more effort into a more decoupled API. Perhaps in a future release... |
|