Migration Operations

A lot of new migrations operatiosn can be used in EF Migrations.
  • CreateView
  • DatabaseCollation
  • DropView
  • GrantTablePermission
  • RemokeTablePermission
  • SqlFile
  • SqlResource

    public partial class InitialModel : DbMigration
    {
        public override void Up()
        {
            this.CreateTable(
                "dbo.Customers",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        FirstName = c.String(),
                        LastName = c.String(),
                    })
                .PrimaryKey(t => t.Id);

            this.CreateView("TheAllCustomersViewName", "SELECT * FROM [dbo].[Customers]");
        }
        
        public override void Down()
        {
            this.DropTable("dbo.Customers");
            this.DropView("TheAllCustomersViewName");
        }
    }

Last edited Oct 24, 2013 at 9:35 AM by UnaiZorrilla, version 2