Skip to content

forfuturellc/migrate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

3c4c223 · Jul 7, 2022

History

34 Commits
Aug 16, 2018
Jul 1, 2022
Jul 1, 2022
Jul 1, 2022
Aug 16, 2018
Aug 16, 2018
Jan 27, 2020
Sep 21, 2019
Sep 23, 2019
Jul 7, 2022
Dec 3, 2017
Jul 7, 2022
Jul 7, 2022
Sep 21, 2019
Jul 1, 2022

Repository files navigation

migrate

Database-agnostic migration framework

usage

# Intro: We have entered into a project that does NOT
# manage database migrations, using this tool.

# Run migrations.
# The tool does not know which database version you are currently at.
# We need to explicitly specify this using the `--current` options.
# Let's assume we are at version `1.0.0` and we want to migrate to
# another version i.e. `1.1.0`
$ npx migrate \
    --current 1.0.0 \
    1.1.0

# From now on, we do NOT need to specify the --current option.
# The tool keeps history.

# ... new migrations added ...

# Migrate to the application's current version as
# specified in the relevant package.json.
$ npx migrate --package-path ./package.json

# Migrate to the latest version available.
$ npx migrate --latest

# Migrate to a specific version (e.g. 1.4.0).
$ npx migrate 1.4.0

# Undo last migration.
$ npx migrate --undo

# List available migrations/versions.
$ npx migrate --list

# Show current database version we are at.
$ npx migrate --which

# Show a brief history of migrations.
$ npx migrate --history

# Show help information.
$ npx migrate --help

installation

# From npm:
$ npm install @forfuture/migrate

# From GitLab:
# Replace 'v0.2.4' with the latest version.
# See git tags.
$ npm install gitlab:forfuture/migrate#v0.2.4

license

The MIT License (MIT)

Copyright (c) 2017 Forfuture LLC we@forfuture.co.ke