0.0.26 • Published 5 years ago

ez-migrate v0.0.26

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

EZ Migrate

THIS PACKAGE IS STILL IN DEVELOPMENT SO USE AT YOUR OWN RISK!

This is a database-agnostic data migration orchestration CLI tool.

Installation

$ npm install -g ez-migrate

Cli interface

  Usage: ez-migrate [options]

  Options:

    init                 Initializes migrations folder
    run [migration]      Runs migration [migration]
    revert [migration]   Reverts migration [migration]
    revert-all           Reverts all executed migrations
    run-latest           Executes migrations that have not been run
    executed-migrations  List of executed migrations

SAMPLE MIGRATION FILE:

const MongoClient = require('mongodb').MongoClient;
const url = 'mongodb://localhost:27017/test';

module.exports = {
    async up() {
        const client = await MongoClient.connect(url, { useNewUrlParser: true, useUnifiedTopology: true });
        if (!client) return;

        const db = client.db('test');
        await db.collection('cars').insertOne({
            make: "audi",
            model: "R8"
        });
    },

    async down() {
        const client = await MongoClient.connect(url, { useNewUrlParser: true, useUnifiedTopology: true });
        if (!client) return;

        const db = client.db('test');
        await db.collection('cars').remove();
    }
}
0.0.25

5 years ago

0.0.26

5 years ago

0.0.23

5 years ago

0.0.24

5 years ago

0.0.22

5 years ago

0.0.21

5 years ago

0.0.20

5 years ago

0.0.19

5 years ago

0.0.16

5 years ago

0.0.17

5 years ago

0.0.18

5 years ago

0.0.15

5 years ago

0.0.14

5 years ago

0.0.13

5 years ago

0.0.12

5 years ago

0.0.11

5 years ago

0.0.10

5 years ago

0.0.9

5 years ago

0.0.8

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago