How can I generate DDL scripts from Entity Framework 4.3 Code-First Model?

.net, c#, ef-code-first, entity-framework, entity-framework-4.3

Solution

You can generate the script using

Update-Database -Script

(from the Package Manager Console)

You can find further details in this walkthrough, which also describes some of the additional options you might need.

Problem

I have a project I'm trying to deploy and I'm using a cheap host to get started. As part of the hosting package I have a SQL Server database, but I don't have drop or create privileges, I can only use the database they've created for me. Being that's the case, I want to get the DDL so I can run it manually. I'm aware I could script the database create scripts from SQL Management Studio, and that may ultimately work fine, but I'd like to automate the process as much as possible, so if I could get the scripts that Entity Framework creates, that would be ideal.

Original source