Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Deploying a Project

All projects in SQL Migration Tool can be managed directly by the desktop application, or they can be integrated into your CI/CD pipeline to run on deployment.

Every project created by SQL Migration Tool includes a package.json file with a setup to install the 2am-smt Node.js module for your project to facilitate deployment.

You can install 2am-smt globally and use it from NPM, or you can use it locally per project to avoid version conflicts.

This guide will explain the local version.

To run the deployment, Node.js is required. Prefer LTS (Long Term Support) versions as they have the most stable code.

Your project’s README records the version of Node.js it was created with. While the specific version of Node.js doesn’t matter much (any version that can run 2am-smt will work), it is good practice to use that version, though not required.

The following commands should be added to your CI/CD pipeline to be run from the project’s root:

npm install
npm run migrate <env>

Replace <env> with your environment of choice. This must be the name specified in the configuration.yml file of the project.

The command npm install will install Node.js modules and 2am-smt for this project.

The command npm run migrate <env> is (by default) equivalent to 2am-smt migrate:to -a <env>, which means it will apply all migrations (without prompting for confirmation) for the defined <env>.

All commands specified by npm run are defined in the project’s package.json file in the scripts key.