We are finding that it works well, and is very productive, for us to drive our database schema entirely off the LightSpeed model. I.e. to use the DB schema exactly as generated by LightSpeed, with no hand-coded modifications.
But there's a problem: it is hard to deploy a correctly-structured database to any place other than a developers machine. Possible solutions, in approximate order of (our) preference are as follows:
Whenever a developer saves a LightSpeed model, it saves not only the model and the generated cs file, but also a .sql file that creates all the matching tables. (Then we can check both into source control)
LightSpeed exposes a method called (something like) GetDatabaseCreationScript. We could call this, in a post build event, to get the script.
LightSpeed exposes a (supported) method to actually create the database. I.e. a programmatic way, at runtime, to do what "Update Database" does from the designer. (But with no dialog boxes, of course).
P.S. In options 1 and 2, it would be important for the resulting SQL to be sorted in a consistent sort order. (Probably alphabetically by table name). Why? So that we can diff it against previous checkins. (Can't really diff if the order keeps changing).
Status: New
|