Skip to main content

Migration engine for MongoDB

Project description

MongoDb Migrator

Migration engine for MongoDB

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 any file.
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, wil l 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

from code:

MigrationManager.migrate()

Revert migrations

CLI

$ mmigrator revert

from code:

MigrationManager.revert()

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.1.0.tar.gz (5.6 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.1.0-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for mmigrator-0.1.0.tar.gz
Algorithm Hash digest
SHA256 22d303ebda1365de9d98f1fffddb77b185ee7102b1fbd728520b2f18c1d576df
MD5 86dd6b667bba4c6f58f1fb7bdbc36d43
BLAKE2b-256 727684c5f30b3c2c78390f95d65724785f2f29df01c138f69fa297b61931534a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mmigrator-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f34e1707e08a52d8a04da8b66047f93fc68c862d735d2f2e503c4e5941f9a657
MD5 d8303a865d6aebd73aea32ee8a17975e
BLAKE2b-256 45afaed10b83309dca70302104e9f6a4d640bb243a803a60445ec8577f59745f

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