-
Notifications
You must be signed in to change notification settings - Fork 0
Home
DeploySQL is a small set of Python scripts, to automatically run SQL scripts to update a database.
Also has a script to dump database objects to disk, so that they can be searched or committed to source control.
This provides a low overhead method of keeping your SQL scripts up to date in source control.
-
create or update most database objects, such as schemas, tables, stored procedures, views, user defined functions
-
write simple CSV files to describe what SQL scripts to apply
-
only the necessary SQL scripts are applied to the database, according to the current version of the database
-
easily update multiple instances of the same database: for example in dev, in test, and then in production.
-
automatically backs up existing database objects, before updating them
-
SQL Server 2005 or higher
-
SQL Server Management Studio 2005 or 2008
-
Python 2.7.x http://www.python.org
-
Powershell 2.0 already installed on Windows 7
In SQL Server Management Studio: (and SQL Server 2005 or later)
1a. create a login dev with password dev123
1b. create a database devTest
1c. add user dev to the database, mapped to the login dev
-
run this script:
table\dbo.tblDatabaseVersion.Table.sql
-
run these 2 scripts: dbo.spDatabaseVersion_GetVersion.StoredProcedure.sql dbo.spDatabaseVersion_SetVersion.StoredProcedure.sql
-
open a command line ( Start menu → Run → cmd )
-
run the copy script, to copy the scripts to a release location:
scripts\copy_new_SQL_to_deploy.bat
-
run the deploy script to apply the scripts to the database:
scripts\run_deploySQL.bat
hint: to deploy the SQL more than once, then run this script to clear the output files (including the SQL backup): clear_output_files.bat