0.0.26 • Published 4 years ago

ez-migrate v0.0.26

Weekly downloads
2
License
MIT
Repository
github
Last release
4 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

4 years ago

0.0.26

4 years ago

0.0.23

4 years ago

0.0.24

4 years ago

0.0.22

4 years ago

0.0.21

4 years ago

0.0.20

4 years ago

0.0.19

4 years ago

0.0.16

4 years ago

0.0.17

4 years ago

0.0.18

4 years ago

0.0.15

4 years ago

0.0.14

4 years ago

0.0.13

4 years ago

0.0.12

4 years ago

0.0.11

4 years ago

0.0.10

4 years ago

0.0.9

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago