by Richard Mason
20. December 2007 06:44
RikMigrations includes support for generating an initial migration from an existing database. Currently this only supports SQL Server databases. The feature was included in the initial release, but hadn't had much testing. Since then I've tested it on a database at work and confirmed it's working correctly (at least to some extent). The migration generator attempts to ensure tables are created in the correct order, but this feature was hacked in and needs improving. In doesn't support circular dependencies so don't even try.
The generator only supports generating in C# at the moment, however it uses CodeDom so other support for other languages is simple to add and a quick hack of the code will provide a version for your favourite language.
To generate a migration from a database use the following command line:
RikMigrations auto -s:(local) -db:Test -f:Migration.cs
You can also add the "-sf" flag to write each table into a separate class, but make sure you include a "{0}" in the filename to indicate where to place the name of the table.
d53b8c93-3656-4c3b-b284-17edb0200d3d|0|.0
Category: RikMigrations
Tags: