RikMigrations - Advanced

Primary Keys

Single Column

Single column keys can be created directly on the column.

table.AddColumn("ID", typeof(int)).PrimaryKey();

Multiple Columns

Multiple column keys are added through the AddConstraint method:

table.AddConstraint("PK_Test", ConstraintType.PrimaryKey, "Col1", "Col2");

Foreign Keys

Foreign keys are created on Column objects using the References method:

table.AddColumn("BlogID", typeof(int)).References("Blogs", "ID").NotNull();

Back to RikMigrations Homepage

About Us

RikWare is a software development company based in Brisbane, Australia. Led by director, Richard Mason, RikWare focusses on solving challenging business problems promptly and effectively.

RikWare is also the owner of Aussie Bushwalking, a free, wiki-like collaboration site for bushwalkers and the creator of RikMigrations, a migration framework for .NET.

Aussie Bushwalking

Want to discover some new bushwalking ideas? Share a few of your own? Aussie Bushwalking is like Wikipedia... but for bushwalkers. Head on over. Anybody can see the walks and it's free to sign up and share your own.



RikMigrations is a database migration library for .NET based on the migrations facility provided by Ruby on Rails. It allows simple upgrading and downgrading of databases using .NET code (such as VB or C#) either from the command line or built into your application. Unlike many other migration frameworks, RikMigrations is a stand-alone library which does not rely on a large surrounding framework.