Skip to content
Sean Ryan edited this page Feb 9, 2020 · 1 revision

Welcome

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.

Features

  • 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

Prerequisites

How to use

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

  1. run this script:

table\dbo.tblDatabaseVersion.Table.sql

  1. run these 2 scripts: dbo.spDatabaseVersion_GetVersion.StoredProcedure.sql dbo.spDatabaseVersion_SetVersion.StoredProcedure.sql

  2. open a command line ( Start menu → Run → cmd )

  3. run the copy script, to copy the scripts to a release location:

scripts\copy_new_SQL_to_deploy.bat

  1. 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

Clone this wiki locally