Skip to main content

Migration engine for MongoDB

Project description

MongoDb Migrator

Migration engine for MongoDB
Supports CLI

Installation

$ python -m pip install mmigrator

Configuration

init command (see below) will create a mmigrator.config.json file with following structure:

{
    "dist": "migrations",
    "connection": {
        "host": "",
        "port": "",
        "database": "",
        "user": "",
        "password": ""
    }
}

Connection variables could be set from .env|.json files.
e.g. from .env file:

"host": ".env[MONGO_HOST]",
"port": ".env[MONGO_PORT]",
"database": ".env[MONGO_DB]",
"user": ".env[MONGO_USER]",
"password": ".env[MONGO_PASSWORD]"

Usage

Help

$ mmigrator help

Init configs

optional, will run automatically on any migration command*

CLI

$ mmigrator init

from code:

from mmigrator import MigrationManager
...
MigrationManager.init()

Create migration

CLI

$ mmigrator g SomeName
# or
$ mmigrator new SomeName

from code:

MigrationManager.generate("SomeName")

Run migrations

CLI

$ mmigrator migrate
# or add --silent flag for dry-run (skip exceptions)
$ mmigrator migrate --silent

from code:

MigrationManager.migrate()
# or add silent=True flag for dry-run (skip exceptions)
MigrationManager.migrate(silent=True)

Revert migrations

CLI

$ mmigrator revert
# or add --silent flag for dry-run (skip exceptions)
$ mmigrator revert --silent

from code:

MigrationManager.revert()
# or add silent=True flag for dry-run (skip exceptions)
MigrationManager.revert(silent=True)

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

mmigrator-0.2.3.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mmigrator-0.2.3-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file mmigrator-0.2.3.tar.gz.

File metadata

  • Download URL: mmigrator-0.2.3.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.3

File hashes

Hashes for mmigrator-0.2.3.tar.gz
Algorithm Hash digest
SHA256 69e86daaf63fdf7f2a8d0de3d1baf3a20ffb3507f5f8efb8cc72b08c8a03d0c8
MD5 ef48efb8ab107206ac9711352cab7e41
BLAKE2b-256 5f4db9e1aeec8ed27e506d52061af7a10fd05014dd3f58aa6122617faf444db6

See more details on using hashes here.

File details

Details for the file mmigrator-0.2.3-py3-none-any.whl.

File metadata

  • Download URL: mmigrator-0.2.3-py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.3

File hashes

Hashes for mmigrator-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 5e8f00d00881c67122695c62744a02a40b5eb75ea69b17789224b8b01d1a006d
MD5 919c21a2aac9185d29d18675ed706481
BLAKE2b-256 01474a8ad03c146429797f03230712c4d85c1c609ca4a87812adbd980546d229

See more details on using hashes here.

Supported by

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