Marcelo Myara
Marcelo Myara

Reputation: 3011

Creating a StoredProcedure during Migrations UpdateDatabase

Using MVC 4 With EntityFramework, is there a way to create my stored procedures during the execution of a given migration (just after the scaffolded table creations, for insitance)? This would surely make my deploys easier, since no external SQL script would be necessary for setting up the DataBase.

If so, what would be the syntax for it?

Upvotes: 0

Views: 50

Answers (1)

Lukas Kabrt
Lukas Kabrt

Reputation: 5489

You can run arbitrary SQL command as a part of your migration.

public override void Up() {
    Sql("CREATE PROCEDURE ...");
}

Upvotes: 1

Related Questions