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 :) I have a problem with migrations in LS 3.0 (build from 15th january). I have created migration project and first migration class. Every thing is ok, but when I add / modify entity I can`t create new migration (items in migration menu are disabled).
Please Help me! |
|
|
It looks like the .lsmodel file can't find the migrations project. Could you post the XML contents of the .lsmodel file, and a screenshot of your Solution Explorer showing your solution structure (i.e. the projects in the solution). Thanks! |
|
|
<?xml version="1.0" encoding="utf-8"?>
project with ls model is under /application directory, migrations are under /migrations dir
|
|
|
okay, when migration project and model project are in same directory - every thing works fine!
I have another question. Is it possible to add some test data with migrations ? (i know that i can create new uow and then add somedata, but is there other way to do this ? ) |
|
|
It looks like there may be a bug in handling migrations projects in folders. I will investigate this further, but in the meantime could you try the following: * Move your migrations project out of the subfolder (e.g. remove it from the solution and add it at the root level). * Back up your .lsmodel file. * Open your .lsmodel file in an XML editor. * On the <model> tag (root element), locate the migrationProjectName attribute. * Change this attribute to "Estima.Application.Migrations\Estima.Application.Migrations.csproj" (i.e. remove the migrations\ prefix). * Save and close the .lsmodel file. * Re-open the .lsmodel file in the normal designer. I realise long-term you'd like to keep the migrations project in a subfolder but hopefully this will be enough to get you going for now. |
|
|
Oops, your update arrived while I was writing the previous message. Glad to hear that you have a solution which works for you for now, and we'll get that bug looked into! Re adding test data with migrations: The migrations API deals only with schemas. However, a migration class is just C# code, so you can do anything you like in it. So you can have your migration create data, modify existing data, or whatever. But you will need to write your own code to do that. You can of course use LightSpeed from within your migrations project to do this. One caveat though is that a migration is meant to be something you can run on production machines. So a migration may not be the right place to be adding test data. (It would be appropriate for adding reference data -- say, if a migration created a Country table, it would make sense to populate that Country table as part of the migration.) |
|
|
[quote user="ivan"]One caveat though is that a migration is meant to be something you can run on production machines. So a migration may not be the right place to be adding test data. (It would be appropriate for adding reference data -- say, if a migration created a Country table, it would make sense to populate that Country table as part of the migration.)[/quote] You are right! Thanks for your reply. |
|
|
I'm having problems with running migrations programmatically. I have the migrations set up in it's own project. There seems to be no problem loading the assembly, and the migrator object has no problem connecting to the database, but when I execute the migrations I get the following exception: The version table is not initialised correctly - it either does not exist or has no value. Is this a bug? Does the database need to be set up somehow, or am I doing something wrong? The same migrations can be run from the designer without problems. Here's the code executing them for what it's worth: AssemblyMigrationLoader loader = new AssemblyMigrationLoader("Migrations.dll"); |
|
|
Hi, Thank you for your feedback and I'm sorry to hear you're having some issues with the migrator. What is happening is that the migration framework is checking for a "DBVersion" table and a version column. If it doesn't find this it will try to create it. We have reworked this particular area of code a few times to try and make it more robust and thought we had ironed out the wrinkles - evidently we have not. Could you please let me know:
With that we should be able to identify what the issue is and get you back on track. Kind regards, John-Daniel Trask |
|