Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

knex-migrate

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

knex-migrate

Modern migration toolkit for knex.js

  • 1.4.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
6.9K
increased by15.19%
Maintainers
1
Weekly downloads
 
Created
Source

Knex Migrate

Unix CI Windows CI Modern Node

Modern migration toolkit for knex.js

Features

  • 100% compatible with knex.js migrations cli
  • can migrate upto and downto any migration
  • able to run individual migrations
  • quickly rollback recent migrations
  • redo feature: rollback and migrate again for quick testing
  • runs migrations in transactions
  • friendly ui 🌹

Installation

npm install --save knex-migrate

You should also install knex as it's a peer dependency of this package.

Usage

First, init project with knex init, add migrations with knex migrate:make, and then:

Usage
  $ knex-migrate <command> [options]

Commands
  pending   Lists all pending migrations
  list      Lists all executed migrations
  up        Performs all pending migrations
  down      Rollbacks last migration
  rollback  Rollbacks last batch of migrations
  redo      Rollbacks last batch and performs all migrations

Options for "up" and "down":
  --to, -t    Migrate upto (downto) specific version
  --from, -f  Start migration from specific version
  --only, -o  Migrate only specific version
  --step, -s  Limit the number of migrations to apply

Global options:
  --cwd         Specify the working directory
  --knexfile    Specify the knexfile path ($cwd/knexfile.js)
  --migrations  Specify migrations path ($cwd/migrations)
  --env         Specify environment ($KNEX_ENV || $NODE_ENV || 'development')
  --verbose     Be more verbose

As a convenience, you can skip --to flag, and just provide migration name.

Examples
  $ knex-migrate up                  # migrate to the latest version
  $ knex-migrate up 20160905         # migrate to a specific version
  $ knex-migrate up --to 20160905    # the same as above
  $ knex-migrate up --only 201609085 # apply a single migration, skipping prior migrations
  $ knex-migrate up --step           # apply only the next migration
  $ knex-migrate up --step 2         # apply only the next two migrations
  $ knex-migrate down --to 0         # rollback all migrations
  $ knex-migrate down                # rollback single migration
  $ knex-migrate down --step 2       # rollback the previous two migrations
  $ knex-migrate rollback            # rollback previous "up"
  $ knex-migrate redo --verbose      # rollback and migrate everything

Thank you

License

MIT

FAQs

Package last updated on 20 Dec 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc