GithubHelp home page GithubHelp logo

faunadb-migrate's Introduction

faunadb-migrate

FaunaDB Migrate is a tool to help faunadb developers setup theirs app database. This is not an official tool supported by Fauna

Install

npm i -g git+https://github.com/BrunoQuaresma/faunadb-migrate.git\#master

Before start

Before start you should set FAUNADB_SECRET env variable with a faunadb admin key.

export FAUNADB_SECRET=fnyoursecret-here

Commands

Setup

Setup migrations in faunadb. You should use this command before run the migrations.

faunadb-migrate setup
# or using a scope env
FAUNADB_SECRET=fnyoursecret-here faunadb-migrate setup

Create migrations

Create new migration file inside of ./migrations folder.

faunadb-migrate create create_users

This command will generate the following template for you:

module.exports.up = q => {
  return q.CreateCollection({ name: 'Users' })
}

module.exports.down = q => {
  return q.Delete(q.Collection('Users'))
}

The collection name is not dynamic. "Users" is only a sample.

Migrate

Run the migration files.

faunadb-migrate migrate

Currently we are not handling failures well so in case of runnning mutiple migrations and something get wrong you should remove the "garbage" using the console UI or fauna-shell.

Rollback

Rollback all the previous changes.

faunadb-migrate rollback

Help

See all available commands and params.

faunadb-migrate --help

Improvements

  • Tests, tests and tests
  • Add --force option to ignore errors
  • Better error handling

faunadb-migrate's People

Contributors

brunoquaresma avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.