Skip to content

Instantly share code, notes, and snippets.

@hudo
Created February 1, 2012 12:22
Show Gist options
  • Save hudo/1716800 to your computer and use it in GitHub Desktop.
Save hudo/1716800 to your computer and use it in GitHub Desktop.
FluentMigrator primjer migracijskih skripti
[Migration(1)]
// Može se postaviti i timestamp umijesto rednog broja
// [Migration(201201311705)]
public class CreateUserTable : Migration
{
public override void Up()
{
Create.Table("User")
.WithColumn("Id").AsInt32().NotNullable().PrimaryKey().Identity();
.WithColumn("Username").AsString(50).NotNullable()
.WithColumn("Password").AsString(100)
.WithColumn("Name").AsString(100).Nullable()
.WithColumn("Lastloged").AsDateTime().Nullable()
.WithColumn("Registered").AsDateTime().Nullable();
}
public override void Down()
{
Delete.Table("User");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment