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 All, We are looking at using Lightscape for our project and I have been assigned to evaluate it to see if it will suit our needs. I've gone through the samples, gone through the manual and abused Google but I can seem to find a solution to the issues of migrating. It is important to us that the database and schema be created/changed at runtime, depending on the changes in code. Lightspeed povides a nice way of creating a database and updating the schema from the designer, but obviously this was not intended for production environments. I therefore turned my attention to migrations, which, if I understand correctly, will be able to change the schema at runtime. I made changes to the tables in the designer, selected "Set Migration Project" from the "Migrations" menu, and clicked "New Project...". Unfortunately this does not appear to do anything, so I tried to create an new "Class Library" project in the existing solution, as my understanding is that the migrations are stored in a DLL. I made the class inherit from IMigrationLoader and but I am unsure how to implement the GetMigrations method. After this I set the newly created project as the migration project, and selected "Create Migrations". I entered "Movie" as the name (I am using the Getting Started sample) and generated the file. My questions: 1) Since the "New Project" on the "Set Migration" dialog appear to do nothing, is it alright to create a new "Class Library" project? 1) Why do we need to make use of an existing class name for the migration? Does it matter which class name is used? What if multiple entities where changed in one migration, which name do you use? 2) Should my newly created project be an IMigrationLoader, and should it implement GetMigrations()? As mentioned, I have been through the relevant samples, as well as the manual but I just can't get to grips with migrations. Any nudge in the right direction will be appreciated as we need to decide if Ligthspeed will be suited for our needs. Regards. Lightspeed version: 5.0.2597.0, VS 2012 Ultimate, Windows 7 SP1 |
|
|
I'd really appreciate it if someone can reply on this. Without understanding how to use migrations the product will be useless to us, and it seems to me that the documentation has some sort of gap when it comes to creating the DLL for migrations. Please get back to me regarding this as we are interested in purchasing Ligthspeed, but unless we can manage to have an example of migrations working we will be unable to do so. Regards. |
|
|
1a. Using a class library is generally the ideal way to go here. In terms of why the New Project option was not working, did you see any errors emitted in the Output window when executing this? 1b. The simplest way to construct migrations is using the designer, this blog post gives a good synopsis of how to work through this: http://www.mindscapehq.com/blog/index.php/2009/12/15/getting-started-with-lightspeed-migrations/ If you are setting up migrations using code then your migrations should derive from Migration, they need to have a [Migration("yyyyMMddhhmmss")] type attribute applied to the class where yyyyMMddhhmmss is a datetime which represents the version number of the migration. You need to override 2 methods, Up and Down where you can call the available methods to perform schema manipulation. Here is a quick example of how a migration might look:
Here is an example:
|
|
|
Thanks Jeremy. This was what I needed. We've purchase a few licences and will let you know if we experience future issues. Regards. |
|