Versioning Data with Modeling Services Folders
[This content is no longer valid. For the latest information on "M", "Quadrant", SQL Server Modeling Services, and the Repository, see the Model Citizen blog.]
Versioning is a normal part of the application development lifecycle. A typical application that uses the SQL Server Modeling CTP bases a significant amount of its behavior on an underlying data model. There are three main types of versioning scenarios that affect model-driven applications and runtimes: data versioning, schema versioning, and application versioning. This topic focuses on data versioning by using SQL Server Modeling Services.
Note
This topic does not cover schema versioning. For more information about schema versioning, see Versioning Existing Model Schemas.
Models are typically written in Microsoft code name “M”, a text-based modeling language. For more information about using “M” to write models, see "M" Overview. This model can be compiled and loaded into any SQL Server 2008 database. If the target database uses Modeling Services, you can use Modeling Services Folders to support data versioning.
Using Modeling Services Folders to Version Data
Data versioning focuses on changes to the data within a model. In data versioning, the “M” definition of the model remains constant. This means that the associated SQL Server schema also remains unchanged, including database objects owned by the schema, such as tables and views. To change the data within a model, you can directly update the existing data, or you can create a new version of the data and manage separate versions by using Modeling Services Folders.
For example, consider a deployment application that installs specific applications to specific servers based on a model in Modeling Services. In this scenario, the operations staff needs to make changes to deploy the applications to a different configuration of servers. One option involves creating database change scripts that modify the existing data in the deployment model to point to the new servers. This would typically involve taking the database and the associated applications offline for the changes. Note that direct changes to data in Modeling Services can be tracked with operational auditing or change tracking. For more information, see Change Tracking Tasks.
The Modeling Services architecture provides an alternative approach to versioning data by using Folders. Within the model tables and views, each row has an association with a specific Folder. In effect, Folders logically contain model data in the same way that file system folders contain files. In this example, instead of changing the existing deployment data, the operations staff can create a new Folder that is associated with the new deployment plan. All the data from the old model can be copied to the new Folder and then modified to include the new server configuration. If the deployment application is designed to understand Folders, the operations staff can instruct the deployment application to begin using the deployment model in the new Folder. This strategy implements the new deployment plan without altering the data that is associated with the previous plan, which is still in the database. For more information about using Folders to version data, see "Oslo" Repository Versioning.
There are several advantages in using Folders to version model data. Previous versions of the model remain in Modeling Services, and this can be used for analysis or recovery. In the deployment application example, the operations staff could quickly revert to the previous model by pointing the application back to the original model in the first Folder. Alternatively, they could troubleshoot problems with the new deployment model by comparing settings between the old and new models. Using Folders with other Modeling Services design patterns also provides security and management benefits. The Folders for older versions of the model could be set to read-only, or permission to various versions of models could be secured to specific individuals or groups. And when the older models are no longer needed, removing the Folder removes all data associated with the Folder.
There are several ways to create Folders and to add data to Modeling Services databases that use Folders. The SQL Server Modeling CTP installs the Mx.exe tool that has a createFolder command that creates new Folders. For an example that uses this technique along with “M” code to load model instance data, see Getting Started with "Oslo" Tutorial. Folders can also be added and managed by using Transact-SQL statements. For more information, see How to: Create and Use "Oslo" Repository Folders. For details on how to use Microsoft code name “Quadrant” to manage Folders, see How to: Use Folders to Organize Data in "Quadrant".
See Also
Other Resources
"Oslo" Repository Versioning
Versioning Scenarios
"Oslo" Repository Lifecycle