@zero-version/mssql-migrate

A simple migration tool for Microsoft Sql Server

Usage no npm install needed!

<script type="module">
  import zeroVersionMssqlMigrate from 'https://cdn.skypack.dev/@zero-version/mssql-migrate';
</script>

README

mssql-migrate

A simple migration tool for Microsoft Sql Server

Install

npm install @zero-version/mssql-migrate --save-dev

Usage

Under the hood, mssql-migrate uses mssql with the default tedious driver. For commands that connect to a database, the arguments map to the options in these packages.

create-database

# Basic Example

npx migrate create-database MyDatabase -s MY_SERVER_NAME -u admin -pw p@$w0rd

# With a windows account (via NTLM)

npx migrate create-database MyDatabase -s MY_SERVER_NAME -at ntlm -dm MY_DOMAIN -u windows_user -pw p@$w0rd

Run npx migrate help create-database for more options.

create-login

# Basic Example

npx migrate create-login new_user_name new_password -s MY_SERVER_NAME -d MyDatabase -u windows_user -pw p@$w0rd

# With a windows account (via NTLM)

npx migrate create-login new_user_name new_password -s MY_SERVER_NAME -d MyDatabase -at ntlm -dm MY_DOMAIN -u windows_user -pw p@$w0rd

Run npx migrate help create-login for more options.

create-migration

# Basic Example

npx migrate create-migration

Run npx migrate help create-migration for more options.

run-migrations

# Basic Example

npx migrate run-migrations /path/to/migrations -s MY_SERVER_NAME -d MyDatabase -u windows_user -pw p@$w0rd

# With a windows account (via NTLM)

npx migrate run-migrations /path/to/migrations -s MY_SERVER_NAME -d MyDatabase -at ntlm -dm MY_DOMAIN -u windows_user -pw p@$w0rd

Run npx migrate help run-migrations for more options.

drop-database

# Basic Example

npx migrate drop-database MyDatabase -s MY_SERVER_NAME -u admin -pw p@$w0rd

# With a windows account (via NTLM)

npx migrate drop-database MyDatabase -s MY_SERVER_NAME -at ntlm -dm MY_DOMAIN -u windows_user -pw p@$w0rd

Run npx migrate help drop-database for more options.