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
|
Hello, Migrations is one of the features that make LS appealing. I wrote a simple WinForms application to run migrations and have a couple of questions.
Many thanks for a great feature. Thanks, Werner
|
|
|
It turns out one cannot seed the database in the same "Up" method of the migration that is also creating the schema. Its just times out. One has to ceate a new migration. Can a future version of LS allow me to create a new empty Migration in Visual Studio 2010, perhaps as a new menu item?
|
|
|
1. We don't currently provide a direct way to get the number of migrations due to be executed, but I think you could get this by doing a preview-only migration and counting the number of MigrationExecuted events. It's a bit of a hack but I think it will work. Similarly, to determine which index is being executed now, you would have to keep a count. (The migration object is of course available via the event args.) 2. The available migrations or the migrations due to be executed? You can get the list of all available migrations via IMigrationLoader.GetMigrations. For the migrations due to be executed, again I think you would need to do a preview-only migration and track the events. 3. The name is the class name of the migration object. To get the description, look for DescriptionAttribute on the type of the migration object. 4. Unfortunately this is not possible at the moment. It is on the wish list but for now you will need to separately extract the information. 5. No, I'm afraid not. However, you may be able to build your own component that reads into a LightSpeedContext from an arbitrary IConfigurationSource -- I'm not sufficiently familiar with EntLib to offer any guidance but we'd be interested to see this if you decided to tackle it! 6 (+update in subsequent message). I've updated the generator so that if there are no changes it will now give you the option to create a blank migration. This will be in the next nightly build. Note also that migrations are just classes derived from Migration, so you can always add migration classes to the migration project by hand (the only thing to watch out for is that you must supply a version which is correctly ordered with regard to the other migration classes -- generated versions are based on timestamps so the safest strategy is to do the same). I'm not sure if this will solve the problem because the issue may be that the migrator creates a transaction around each migration, and the timeout may be coming from the UOW transaction fighting with the migrator transaction. We'll be happy to continue to work with you to improve this. |
|
|
Thanks Ivan,
Again, many thanks. Werner
|
|
|
1. No impact. A preview-only run just enumerates the migrations: it doesn't actually execute anything, so it doesn't matter if the migration involves large amounts of work. That is, we only preview which migrations will run, not what they will do. 3. We'll keep this in mind but it's not planned. You can always write an extension method for this: public static string Description(this Migration migration) { |
|
|
Migrations running in preview mode fails against an empty database with the following message:
"The version table is not initialised correctly - it either does not exist or has no value."
|
|