The ADO.NET team today on July 28, announced the release of the first Community Technical Preview (CTP) of Code First Migrations work.
"This initial CTP is primarily focused on the developer experience inside of Visual Studio. We realize this isn't the only area in which migrations is important and our team is also working on scenarios including team build, deployment and invoking migrations from outside of Visual Studio as well as from custom code."
- If you've previously run the EF 4.1 stand alone installer you'll need to upgrade or remove the installation before using migrations. This's required because the installer adds the EF 4.1 assembly to the Global Assembly Cache (GAC) causing the original RTM version to be used at runtime rather than Update 1.
- This release is incompatible with "Microsoft Data Services, Entity Framework, and SQL Server Tools for Data Framework June 2011 CTP".
Some known issues, limitations and 'yet to be implemented' features include:
- "There's no provider model, this release only targets SQL Server, including SQL Azure. SQL Compact and other providers aren't supported.
- All existing tables will be re-built during first migration. The components we're using for schema comparison are overly sensitive to things such as ANSI_PADDING. This often results in tables being rebuilt when you swap to using migrations to maintain the schema.
- Extra database constructs, such as indexes, can not be added in custom scripts. If you add an index in a custom script it'll be removed by the next automatic upgrade.
- Migrations is overly sensitive to column ordering and will re-build a table to insert a column in the correct order.
- Custom scripts that migrations scaffolds are verbose and include a lot of additional SQL that isn't required.
- Migrations currently needs to run in full trust. This isn't an issue when working inside of VS but if consuming the migrations assembly from custom code you may want to run in medium trust.
- There's a known issue that may result in a "The project '<project name>' doesn't contain or reference any contexts." error message. This issue occurs when your context is defined in a referenced project and NuGet's Package Manager Console (PMC) is initialized before your solution is loaded. If you encounter this behavior, close PMC and restart VS taking care not to reopen PMC until after your solution has loaded.
- The performance of migrations isn't ideal in this preview.
- Previewing changes via '-Script' option only works after the schema has been upgraded at least once using migrations. If you haven't used migrations on the database you'll just get a create script for the entire database when using '-Script'.
- Downgrade is currently not supported. When generating custom scripts you'll notice that the script is named 'Up.sql' but there's no corresponding 'Down.sql'.
This initial CTP is available via NuGet as the EntityFramework.SqlMigrations package. Once installed, a number of additional migrations commands are available in the Package Manager Console inside of Visual Studio.
Migrations is dependent on EF 4.1 Update 1, this updated release of EF 4.1 will be automatically installed when you install the EntityFramework.SqlMigrations package.
[Source: ADO.NET team blog]