Giter VIP home page Giter VIP logo

mssql-deploy's Introduction

MSSQL Deploy

Automated SQL Server deployment tool that runs 'SqlPackage' and 'SqlCmd' based on JSON configuration

Requirements

mssql-deploy requires an installation of SqlPackage and SqlCmd from Microsoft

SqlPackage and SqlCmd should be accessible from a directory on PATH

On Windows the tool also looks for the executalbes at:
%ProgramFiles%\Microsoft Sql Server\150\DAC\bin\SqlPackage.exe and
%ProgramFiles%\Microsoft Sql Server\110\Tools\Binn\SQLCMD.exe respectively.

Installation

Download the latest build for your OS

Usage

The executable requires a .json configuration file as input, each root element of the JSON document runs a single execution of sqlpackage or sqlcmd if that's the Action with the arguments for the execution defined within.
All the possible sqlpackage arguments can be found on Microsoft's website

Run the executable with your deployment configuration:

mssql-deploy deploy-config.json

Example configuration file: deply-config.json

{
    "Erp2009_lite-destroy": {
        "Action": "sqlcmd",
        "S": "localhost",
        "U": "SA",
        "P": "12345678!",
        "Q": "IF EXISTS(SELECT * FROM sys.databases WHERE name='nav2009_lite') BEGIN ALTER DATABASE [nav2009_lite] SET SINGLE_USER WITH ROLLBACK IMMEDIATE; DROP DATABASE [nav2009_lite]; END"
    },
    "Erp2009_lite-deploy": {
        "Action": "Import",
        "SourceFile": "nav2009_lite.bacpac",
        "TargetServerName": "localhost",
        "TargetDatabaseName": "nav2009_lite",
        "TargetUser": "SA",
        "TargetPassword": "12345678!"
    },
    "Production": {
        "Action": "Publish",
        "SourceFile": "development/dev_prod/bin/Debug/dev_prod.dacpac",
        "TargetDatabaseName": "prod",
        "TargetServerName": "localhost",
        "TargetUser": "SA",
        "TargetPassword": "12345678!",
        "p": {
            "IncludeCompositeObjects": true,
            "CompareUsingTargetCollation": true,
            "CreateNewDatabase": true
        }
    },
    "Staging": {
        "Action": "Publish",
        "SourceFile": "development/dev_stg_nav/bin/Debug/dev_stg_nav.dacpac",
        "TargetDatabaseName": "stg_nav",
        "TargetServerName": "localhost",
        "TargetUser": "SA",
        "TargetPassword": "12345678!",
        "p": {
            "IncludeCompositeObjects": true,
            "CompareUsingTargetCollation": true,
            "CreateNewDatabase": true
        }
    }
}

Build & Development

The project uses pipenv for managing packages and virtual environment.

Install pipenv with pip or optionally brew (MacOS)

pip install pipenv

Install packages:

pipenv install

Run the program within the virtualenv

pipenv run python app.py

Build the program from within the virtualenv with pyinstaller

pipenv shell
pyinstaller --onefile app.py -n mssql-deploy
exit

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

MIT

mssql-deploy's People

Contributors

birkirbrynjarsson avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.