0.3.1 • Published 4 years ago

firestore-migrate v0.3.1

Weekly downloads
39
License
ISC
Repository
-
Last release
4 years ago

Firestore-migrate

Migration tool for firestore data that supports typescript migrations.

Very basic design, use at your own risk!

Installation

npm install firestore-migrate

Usage

There are two ways to use this tool.

  • As a commandline tool.
  • Calling migrate programmatically.

Creates a new Document at config/migration to track the version of the datastore.

Command line

create

Creates a new firestore migration file with filename <version>__<name>.ts.

npx firestore-migrate create <name> <release-type> --path [path]
  • <name>: A lower kebab case name to identify the migration.
  • <release-type>: Semver release increment. Either "major", "premajor", "minor", "preminor", "patch", "prepatch" or "prerelease".
  • -p, --path [path]: Defaults to ./migrations
npx firestore-migrate create new-collections patch

migrate

This requires that you have the environment variables set for admin to initialise without parameters.

npx firestore-migrate migrate --path [path]
  • -p, --path [path]: Defaults to ./migrations
  • -t, --to [to]: Version to migrate up or down to. Updates to latest when not passed.

Programmatically

Alternatively you can call migrate programmatically. This is useful for running in cloud functions where the env variables are already set for you.

import { migrate } from 'firestore-migrate';

migrate({ path: './migrations' });
0.3.1

4 years ago

0.3.0

4 years ago

0.2.1

4 years ago

0.2.0

4 years ago

0.1.8

4 years ago

0.1.9

4 years ago

0.1.7

4 years ago

0.1.4

4 years ago

0.1.6

4 years ago

0.1.5

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.3

4 years ago

0.1.0

4 years ago