Skip to main content

MongoDB Migrations for Python 3.5+

Project description

Mongrations

alt text A MongoDB migrations tool for Python 3.5+.

Install

pip install --upgrade mongrations

or

git clone https://github.com/ableinc/mongrations.git
cd mongrations
pip install --upgrade .

Use

Mongrations comes with a CLI Tool as well as a class for a pythonic migration approach

CLI

Usage: mongrations [OPTIONS]

Options:
  -M, --migrate BOOLEAN  Run MongoDB migrations
  -C, --create BOOLEAN   Create new MongoDB migration
  -N, --name TEXT        Name for newly created migration
  -F, --file_path TEXT   File path for newly created migration
  -U, --undo BOOLEAN     Undo last MongoDB migration
  -D, --down BOOLEAN     Clean MongoDB database
  --version              Show the version and exit.
  --help                 Show this message and exit.

CLI Examples

mongrations -C true --name [migration_name]  # create new migration
mongrations -M true  # run migrations
mongrations -D true  # tear down migrations
mongrations -U true  # undo last migration

Mongrations Class

from mongrations import MongrationsCli

migrations = MongrationsCli()

migrations.create(file_path='file/path', name='file_name')
migrations.migrate()
migrations.down()
migrations.undo()

Run example migration in examples/ folder

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mongrations-0.0.1.tar.gz (4.2 kB view hashes)

Uploaded Source

Built Distribution

mongrations-0.0.1-py3-none-any.whl (5.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page