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