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

migrado

v1.0.6

Published

ArangoDB migrations and batch processing manager

Downloads

21

Readme

Migrado

Node package Build status

🥑 ArangoDB migrations and batch processing manager.

migrado is a command-line client that can help build and run schema or data migrations against your ArangoDB instance.

migrado utilizes ArangoDB Transactions when running data migrations to ensure failed scripts are rolled back automatically. arangosh from the ArangoDB Client Tools is required to run schema migrations, however no transaction safety is available at this point.

migrado should be considered alpha software. Make sure you test well before using in a production setting.

If you have trouble, open an issue. Contributions are welcome.

Installation

migrado requires Node.js 12 or higher.

$ yarn add migrado

or

$ npm install -s migrado

Data migrations

You need to declare all collections subject to write operations using the syntax // write collection_name, because ArangoDB needs this information for locking during transactions. We've made the declaration explicit to reduce errors. Attempting to write to collections not declared in this way will cause the migration to fail.

In general, a reverse migration should do the logical opposite of a forward migration. forward() and reverse() functions can contain anything that the ArangoDB V8 engine understands, but must be fully self-contained. Anything outside these functions is ignored and unavailable when running migrations.

Here's an example migration script for adding new_field in collection things:

// write things

function forward(db) {
    var db = require("@arangodb").db
    db.query(`
        FOR thing IN things
            UPDATE thing WITH { new_field: "some value" } IN things
    `)
}

function reverse(db) {
    db.query(`
        FOR thing IN things
            REPLACE thing WITH UNSET(thing, "new_field") IN things
    `)
}

More Examples

Please make sure you read limitations when running transactions in the ArangoDB documentation. In particular, creation and deletion of databases, collections, and indexes is not allowed in transactions.

Schema migrations

Schema migrations are stuctured in the same way as data migrations, but are run against arangosh as opposed to the HTTP API. There is no transaction safety when running schema migrations.

Schema migrations are structured the same way as data migrations, but // write declarations are not required. All operations are allowed.

Here's an example migration script generated from the YAML schema above:

function forward(db) {
    db._createDocumentCollection("books")
    db._createDocumentCollection("authors")
    db._createEdgeCollection("author_of")
}

function reverse(db) {
    db._drop("books")
    db._drop("authors")
    db._drop("author_of")
}

Please be careful when running schema migrations in reverse. As you can see, the reverse() function above would drop your collections if you were to reverse beyond this point. Currently, you will not be able to do so for an initial migration.

Influenced From