npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

mongoose-data-migrate

v0.1.2

Published

Data migration framework for node.js using mongoose

Downloads

4

Readme

mongoose-data-migrate

Mongodb data migration tool using node.js and mongoose. Heavily inspired by madhums/mongoose-migrate.

At a high level, here's how you use it:

  1. run 'mongoose-data-migrate create my-migration1' to create your migration files. The files are created in the migrations folder in the root of your project.
  2. implement the up and down methods in each migration file.
  3. running 'mongoose-data-migrate up' will run all migration files that are in the migrations folder that have not yet been run.
  4. running 'mongoose-data-migrate down' will execute the down method on all migration to the point that the previous 'migrate up' was run.

Installation

$ npm install -g mongoose-data-migrate
	

Usage

Usage: mongoose-data-migrate [up|down|create] 

Commands:

   up               run all new migrations since the previous run
   down             migrate down to the point of the previous migrate up
   create [title]   create a new migration file with optional [title]

Config file

mongoose-data-migrate will store the current state of migrations in a collection in mongodb. Therefore, a config file is required in order to provide the connection details to the mongodb instance.

Place the config file in the root of your project as ./config/migrations.js

The config file format is:

module.exports = {

	// The location of the the mongoose module. Since mongoose-data-migrate
	// needs to make a connection to mongodb, if you point to it here you'll
	// be able to use the same connection in your migration files rather than
	// creating your own connection.
	mongoose: '../node_modules/mongoose',

	// mongodb connection string in mongoose format: 'mongodb://username:password@host:port/database?options...'
	// See: http://mongoosejs.com/docs/connections.html
	db: 'mongodb://localhost:27017',

	// Name for the migrations collection (defaults to 'migrations')
	collection: 'migrations'
};

Mongoose Compatability

So far mongoose-data-migrate has only been tested with Mongoose 3.8.x.

Testing

In order to run the test specs you need to have:

  1. an instance of mongodb running at localhost:27017.
  2. a db named 'mongoose_data_migrate_test' without any credentials

To run the tests:

npm test