Socket
Socket
Sign inDemoInstall

anydb-sql-migrations

Package Overview
Dependencies
Maintainers
2
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

anydb-sql-migrations

Database migrations for anydb-sql


Version published
Weekly downloads
13
increased by18.18%
Maintainers
2
Weekly downloads
 
Created
Source

anydb-sql-migrations

Database migrations for anydb-sql

usage

Create a script called migrate.js and add the following

#!/usr/bin/env node

var myanydbsql = require('./path/to/my/database/instance');

require('anydb-sql-migrate')
.create(myanydbsql, '/path/to/migrations/dir')
.run();

In your migrations dir, create a file named '001-empty-test.js' and add the code

exports.up = function(transaction) {}
exports.down = function(transaction) {}

The first method is run when upgrading the db, while the second is run when downgrading it. Both methods accept a single parameter - the transaction within which that migration should run.

To check for pending migrations, use

./path/to/migrate.js --check

It should show 001-empty-test and return a nonzero exit code

To run pending migrations, use

./path/to/migrate.js --execute

It should run the exported empty up function.

license

MIT

Keywords

FAQs

Package last updated on 01 Nov 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