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
|
I've wrote this code:
How can i now generate db from this code like i do with "update database" command in model design editor? Thanks for help. Morgan. |
|
|
Hi Morgan, If you are writing the entity definitions manually then you will also need to create the database schema manually. If you want to take advantage of database synchronisation then you will need to use the designer.
|
|
|
You can also use LightSpeed migrations. If you're using the designer then it can create starter migration code for you, or you can write the migration code by hand. In either case, your code can then programmatically invoke migrations. For more information, see "Database Migrations" in the LightSpeed user guide. http://www.mindscapehq.com/documentation/lightspeed/Database-Migrations |
|
|
I'm curious whether LightSpeed will implement equivalent functionality as IDatabaseInitializer. Doing so will save me days of work and hours of frustration. I have a hard time to determine exactly how the schema should look like for a given set of classes. Doing code first in LightSpeed is error prone and time consuming. I spend more time figuring out the correct schema for a set of entities in an assembly than I do on business value. Keep in mind I have approx. 200+ entities in my model. It would be beneficial if LightSpeed provides a command line tool to generate the SQL to create a schema for all the entities in an assembly. If I can call it from code (like my tests), so much better. |
|
|
We do have experimental command line tools to update a database schema to a LightSpeed model (compiled DLL, not .lsmodel, so it works with hand-coded classes), and you can log the generated SQL to a file. These run only against an actual database, not a migration checkpoint, and they are alpha at the moment (in fact I'm not sure they've even been tested with LightSpeed 4), but if this is similar to what you want, I can point you at them and we'd be happy to work with you to bring them up to scratch! |
|
|
Ivan, Yes, I'll be really happy to work with you on this, especially if this helps me to understand the database schema LightSpeed expects for entities in an assembly. Werner |
|
|
Sweet, thanks! If you look in the Tools/Designer subdirectory of the install directory, you should see two files named The first of these reads a DLL and creates a .lsmodel file (designer model) from the entity model in that DLL. The second updates a database to conform to a .lsmodel (the equivalent of loading the .lsmodel into the designer and doing an Update Database). By running these two together, you should be able to update a database schema from a DLL. Example usage:
(the log file is optional but you indicated you wanted the SQL). Obviously for long-term use you would probably put this in a batch file but for initial testing it may be better to run them separately by hand. NB the shortcut names for provider types are not supported in I have to stress that these are experimental tools and haven't been updated or tested for a while, so please be patient if you run into errors, bugs or even complete refusal to run! Thanks for helping us improve them! |
|
|
Hi This could be such a great deployment tool outside of VS. I found when using this on my workstation (using the *.2012.exe's) that it creates the schema but does not set the auto inc. indentity columns, tested with both MySql5 and SqlServer2012. Any tips as to how I might be able to fix that? Thanks Myles |
|
|
Hi Myles, Is this for creating a new table where identity column is explicitly specified as the identity method on the Entity? If this is for a modification operation you will need to use your own manual script to migrate over to an identity column.
|
|