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.

Files for mongrations, version 0.0.1
Filename, size File type Python version Upload date Hashes
Filename, size mongrations-0.0.1-py3-none-any.whl (5.6 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size mongrations-0.0.1.tar.gz (4.2 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page