starsol-mongo-migrate


Namestarsol-mongo-migrate JSON
Version 0.1.0 PyPI version JSON
download
home_pageNone
SummaryMongoDB migration tool
upload_time2025-02-23 20:16:25
maintainerNone
docs_urlNone
authorStarSoultion Dev Team
requires_python<4.0,>=3.11
licenseNone
keywords starsol
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # MongoDB Migrations

## Overview
This project includes a CLI tool for managing MongoDB database migrations.

Migration scripts should utilize the `pymongo` library to interact with the database.

Migrations are performed in a transactional manner, 
meaning that if an error occurs during the execution of a migration, 
the migration will be rolled back and the database will be left in the state 
it was in before the migration was attempted.
To support this functionality MongoDB requires a replica set to be configured.


## Installation
```bash
pip install starsol-mongo-migrate
```

## Usage
This project offers a number of CLI commands to manage MongoDB migrations.
### Initialize
Initialize the migration directory and the database version collection:
```bash
python3 -m starsol_mongo_migrate.cli --dir=versions init <your_mongo_uri>
```

### Generate Migrations
Generate a new migration:
```bash
python3 -m starsol_mongo_migrate.cli --dir=versions generate migration_name
```

### List Migrations
List all migrations:
```bash
python3 -m starsol_mongo_migrate.cli --dir=versions list
```

### Upgrade Database
Upgrade the database to a specific revision:
```bash
python3 -m starsol_mongo_migrate.cli --dir=versions upgrade <your_mongo_uri> <target_revision>
```
Upgrade the database to the latest revision:
```bash
python3 -m starsol_mongo_migrate.cli --dir=versions upgrade <your_mongo_uri>
```
Upgrade without using transactions:
```bash
python3 -m starsol_mongo_migrate.cli --dir=versions upgrade --no-transaction <your_mongo_uri>
```

### Downgrade Database
Downgrade the database to a specific revision:
```bash
python3 -m starsol_mongo_migrate.cli --dir=versions downgrade <your_mongo_uri> <target_revision>
```
Downgrade without using transactions:
```bash
python3 -m starsol_mongo_migrate.cli --dir=versions downgrade --no-transaction <your_mongo_uri> <target_revision>
```

### Show Current Revision
Display the current database revision:
```bash
python3 -m starsol_mongo_migrate.cli --dir=versions current <your_mongo_uri>
```


            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "starsol-mongo-migrate",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.11",
    "maintainer_email": null,
    "keywords": "starsol",
    "author": "StarSoultion Dev Team",
    "author_email": "dev@starsolution.team",
    "download_url": "https://files.pythonhosted.org/packages/22/86/23ad309561ea889d97116e5fe0c70e698040982e0d82ac2a12812a71afcf/starsol_mongo_migrate-0.1.0.tar.gz",
    "platform": null,
    "description": "# MongoDB Migrations\n\n## Overview\nThis project includes a CLI tool for managing MongoDB database migrations.\n\nMigration scripts should utilize the `pymongo` library to interact with the database.\n\nMigrations are performed in a transactional manner, \nmeaning that if an error occurs during the execution of a migration, \nthe migration will be rolled back and the database will be left in the state \nit was in before the migration was attempted.\nTo support this functionality MongoDB requires a replica set to be configured.\n\n\n## Installation\n```bash\npip install starsol-mongo-migrate\n```\n\n## Usage\nThis project offers a number of CLI commands to manage MongoDB migrations.\n### Initialize\nInitialize the migration directory and the database version collection:\n```bash\npython3 -m starsol_mongo_migrate.cli --dir=versions init <your_mongo_uri>\n```\n\n### Generate Migrations\nGenerate a new migration:\n```bash\npython3 -m starsol_mongo_migrate.cli --dir=versions generate migration_name\n```\n\n### List Migrations\nList all migrations:\n```bash\npython3 -m starsol_mongo_migrate.cli --dir=versions list\n```\n\n### Upgrade Database\nUpgrade the database to a specific revision:\n```bash\npython3 -m starsol_mongo_migrate.cli --dir=versions upgrade <your_mongo_uri> <target_revision>\n```\nUpgrade the database to the latest revision:\n```bash\npython3 -m starsol_mongo_migrate.cli --dir=versions upgrade <your_mongo_uri>\n```\nUpgrade without using transactions:\n```bash\npython3 -m starsol_mongo_migrate.cli --dir=versions upgrade --no-transaction <your_mongo_uri>\n```\n\n### Downgrade Database\nDowngrade the database to a specific revision:\n```bash\npython3 -m starsol_mongo_migrate.cli --dir=versions downgrade <your_mongo_uri> <target_revision>\n```\nDowngrade without using transactions:\n```bash\npython3 -m starsol_mongo_migrate.cli --dir=versions downgrade --no-transaction <your_mongo_uri> <target_revision>\n```\n\n### Show Current Revision\nDisplay the current database revision:\n```bash\npython3 -m starsol_mongo_migrate.cli --dir=versions current <your_mongo_uri>\n```\n\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "MongoDB migration tool",
    "version": "0.1.0",
    "project_urls": null,
    "split_keywords": [
        "starsol"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "2f22219ade9af6a0b599ff68fb96ea0d6acebbbc538c13d8f3bf6394986916aa",
                "md5": "9da3c4fc855a662a896c8fab2e6edae8",
                "sha256": "e39d602bca9b0d7a5139b6cb00351dcc0cc751e0125f3d824eb42bac50f14f7f"
            },
            "downloads": -1,
            "filename": "starsol_mongo_migrate-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "9da3c4fc855a662a896c8fab2e6edae8",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.11",
            "size": 7949,
            "upload_time": "2025-02-23T20:16:23",
            "upload_time_iso_8601": "2025-02-23T20:16:23.508338Z",
            "url": "https://files.pythonhosted.org/packages/2f/22/219ade9af6a0b599ff68fb96ea0d6acebbbc538c13d8f3bf6394986916aa/starsol_mongo_migrate-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "228623ad309561ea889d97116e5fe0c70e698040982e0d82ac2a12812a71afcf",
                "md5": "91708c722440ddcafbf96ce59dc9404e",
                "sha256": "4916b0408fe43b045f45378b28b1d28de79991d456140cfd6c178655f30a7c81"
            },
            "downloads": -1,
            "filename": "starsol_mongo_migrate-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "91708c722440ddcafbf96ce59dc9404e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.11",
            "size": 6030,
            "upload_time": "2025-02-23T20:16:25",
            "upload_time_iso_8601": "2025-02-23T20:16:25.454031Z",
            "url": "https://files.pythonhosted.org/packages/22/86/23ad309561ea889d97116e5fe0c70e698040982e0d82ac2a12812a71afcf/starsol_mongo_migrate-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-02-23 20:16:25",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "starsol-mongo-migrate"
}
        
Elapsed time: 0.53188s