Skip to content

Instantly share code, notes, and snippets.

@hudo
Created February 1, 2012 12:31
Show Gist options
  • Save hudo/1716821 to your computer and use it in GitHub Desktop.
Save hudo/1716821 to your computer and use it in GitHub Desktop.
FluentMigrator primjer indexa i key-eva
[Migration(2)]
// Može se postaviti i timestamp umijesto rednog broja
// [Migration(201201311710)]
public class CreateUserTable : Migration
{
public override void Up()
{
Create.ForeignKey("fk_tag_user")
.FromTable("Tag").ForeignColumn("CreatorId")
.ToTable("User").PrimaryColumn("Id")
.OnDeleteOrUpdate(Rule.Cascade);
Create.Index("idx_tag_url").OnTable("Tag")
.OnColumn("ShortUrl").Ascending()
.WithOptions().NonClustered().Unique();
}
public override void Down()
{
Delete.ForeignKey("fk_tag_user");
Delete.Index("idx_tag_url");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment