Skip to content
A typescript plugin for db-migrate.
JavaScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
.nmpignore
CHANGELOG.md
LICENSE
README.md fix: Change ts-node dependency to peer dependency Dec 7, 2017
index.js
package.json 2.0.0 Dec 7, 2017

README.md

Plugin-Typescript

A TypeScript plugin for db-migrate.

Usage

Usage is very simple. Simply install this plugin via npm install db-migrate-plugin-typescript or if using yarn: yarn add db-migrate-plugin-typescript

This plugin has a peer dependency on ts-node as well. So you will need to install that as a dependency or dev-dependency as well, npm install ts-node or yarn add ts-node if using yarn.

The plugin will automatically resolve and compile any .ts files in your migrations directory, using your regular tsconfig.json

Do however note that this has no effect on generating new migrations. Using db-migrate create FooMigrations.ts will not create a TypeScript migration file.

Implementation Detail

The plugin hooks into the functionality of db-migrate itself. In this case it hooks into migrator:migration:hook:require, which in this case requires another transpiler (TypeScript) and registers also a new file extension (.ts). Make sure to name your migrations accordingly (ending with .ts).

You can’t perform that action at this time.