Giter Site home page Giter Site logo

xamele0n / dotnet-db-migrate Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ritasker/dotnet-db-migrate

0.0 2.0 0.0 22 KB

A .NET Core Global Tool to deploy changes to SQL databases using DbUp.

Home Page: https://richardtasker.co.uk/2018/09/15/introducing-dotnet-db-migrate

License: MIT License

C# 100.00%

dotnet-db-migrate's Introduction

dotnet-db-migrate

Build status NuGet NuGet

A .NET Core Global Tool to deploy changes to SQL databases using DbUp.

Installation

dotnet tool install -g dotnet-db-migrate

At this point you will probably have to add the global tools path to PATH variable. Global tools are installed to %USERPROFILE%\.dotnet\tools (Windows) or $HOME/.dotnet/tools (macOS/Linux). You can add the tools directory to yur PATH using one of the following commands.

Windows: setx PATH "$env:PATH;$env:USERPROFILE/.dotnet/tools" Linux/macOS: echo "export PATH=\"\$PATH:\$HOME/.dotnet/tools\"" >> ~/.bashrc or your terminal of choice.

You will need to restart your terminal.

Usage

Once installed, running dotnet db-migrate -h will print the following help information.

A tool to deploy changes to SQL databases.

Usage: db-migrate [arguments] [options]

Arguments:
  ConnectionString    Required. The connection details for a database.

Options:
  -h|--help           Show help information
  -p|--provider       Optional. The connection provider. Default: mssql
  -s|--scripts        Optional. The path to the migration scripts. Default: scripts/
  --ensure-db-exists  Optional. Create the database if it doesn't exist. Default: false

Example Usage

dotnet db-migrate "Server=localhost;Port=5432;Database=northwind;User Id=postgres;Password=password;" -p postgres -s src/scripts/Postgres --ensure-db-exists

Output

Master ConnectionString => Host=localhost;Port=5432;Database=postgres;Username=postgres;Password=********
Created database northwind
Beginning database upgrade
Checking whether journal table exists..
Journal table does not exist
Executing Database Server script '201806172131-Create-Contacts.sql'
Checking whether journal table exists..
Creating the "schemaversions" table
The "schemaversions" table has been created
Upgrade successful
Success!

Currently only MS SQL Server and Postgres are supported, this is due to --ensure-db-exists flag and how DbUp creates databases.

Contributing

This is an open-source project. I request your participation through issues and pull requests!

License

dotnet-db-migrate is licensed under MIT. Refer to LICENSE for more information.

dotnet-db-migrate's People

Contributors

ritasker avatar

Watchers

xamele0n avatar James Cloos 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.