I've recently reached the stage where an ASP.net MVC application I am developing is ready to be deployed to the production server. I've worked out how to publish the application - I've got all the files on the server, and can access them over the internet.
However, I can't work out how to deploy my database. The server has the SQL Server Management Studio Express installed, as the database used is a SQL Server Express database. I have the server instance up and running - I just don't know how to add the tables, etc. to the database.
I have created the "CREATE TABLE" scripts on the development machine, but as far as I can see, Management Studio does not provide any way to actually run these scripts. I have looked through all the menu items that I could see, and none of them worked. Even using the "Create new query..." option and pasting the script in didn't work.
When I try "File->Open..." and select a script to run, set the correct database from the dropdown list on the toolbar, and then execute the script, it complains about not finding the database file (even when I set the USE [...]
statement to the correct path.
Deleting the USE [...]
statement, the script complains that it can't find the [dbo].[Invoices]
object; however, it shouldn't be able to find it, because its trying to create it!
tl;dr: What's the best way to make sure that the database on the production machine matches the database on my development machine?
EDIT: One of the scripts is online here. The output (after the first two lines were deleted) is here.