Compound Primary Key

In FluentMigrator, you can create a composite primary key like this:

Create.PrimaryKey("PK_Table").OnTable("Table").WithSchema("schemaname")
    .Columns([|"Col1"; "Col2"|])
    |> ignore

I seem to remember you could just apply the PrimaryKey() method to multiple columns. So to use c2 and c3 as a composite primary key for example:

base.Create.Table(tableName)
    .WithColumn("Id").AsGuid().NotNullable().Unique()
    .WithColumn("c1").AsGuid().NotNullable().Unique()
    .WithColumn("c2").AsString().NotNullable().PrimaryKey()
    .WithColumn("c3").AsString().NotNullable().PrimaryKey()
    .WithColumn("c4").AsDateTime()
    |> ignore

Tags:

F#