title: Entity Framework 5 Code First Migrations: Get database script
body: <p>I've a project following the course of <a href="http://www.johnpapa.net/building-single-page-apps-with-knockout-jquery-and-web-api-ndash-the-story-begins" rel="nofollow">John Papa about SPA</a>.
  So, my architecture is as follows:</p>
  
  <pre><code>**proj.Data.Data**
      /Configuration     
        Mappings of the entities with Fluent
      ProjContext.cs
      ProjInitializer.cs
      EFRepository.cs
      /Migrations folder
  
  **proj.Data.Model**
      Pocos (Entity Framework 5 Code First)
      No reference to Entity Framework
  
  **proj.Data.Contracts**
      Interface for IRepository and IProjContext
  
  **proj.UI.Web**
      MVC 4/WebApi project
  </code></pre>
  
  <p>I had an existing database and I ran reverse engineering of Entity Framework to get the entities and separated the context from the entities (in two different projects as shown above)</p>
  
  <p>Then I ran (selecting proj.Data.Data from the PackageManager Console drop down):</p>
  
  <pre><code>Enable-Migrations -force -StartupProjectName "Proj.Data.Data"
  add-migration InitialSchema
  Update-Database
  Update-Database -Script -SourceMigration $InitialDatabase
  </code></pre>
  
  <p>I only see in the folder Migrations in the proj.Data.Data project a file named 201211091944388_InitialSchema with the up and down methods empty. No MigrationHistory table created.</p>
  
  <p>What do I need to run to get the sql script to generate the database from scratch with all the tables I have got from the entities?</p>
  
  <p>Thanks! Guillermo.</p>
  
  <p><strong>NOTE:</strong> I have .Data projects in a solution folder named Data and Web project in a solution folder named UI, Should I take any extra step because of that?</p>