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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mmigrator-0.2.5.tar.gz.
File metadata
- Download URL: mmigrator-0.2.5.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a71e237d31ac0f4e0c4d202a44efefe40cc833c1325634b3a34a0a59f55088e3
|
|
| MD5 |
06b768499dd14cdceba95f83ce023250
|
|
| BLAKE2b-256 |
47ac88cea5faded37210c54bf495b5434fbc5bfee9d7a0e295d7278359437386
|
File details
Details for the file mmigrator-0.2.5-py3-none-any.whl.
File metadata
- Download URL: mmigrator-0.2.5-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
80dbdc961cecac72f6cd760f1f843049cfaacad9356663e5f86d9f708e22d729
|
|
| MD5 |
244738cb0cd3252a8930ca10f1f95b37
|
|
| BLAKE2b-256 |
640373b5188fe11ef5588ca630c3900e908569b14a783c9b8cf14b4d298ff1ec
|