# Django Migration Rollback v1.0.5
A Django package used to just make the `python manage.py migrate` a little easier for Django apps that commit their migrations and want a way to rollback to a previous migration without needing to check what the which one it is via `python manage.py showmigrations` or in the project's git repository.
## Features
Able to set which branch in a git repository to rollback to using the custom command `migraterollback` or if you wish to just rollback to a previous migration only via `migrateprevious`. Note in order to use the rollback with a git repository's branch feature with git the project must have a `.git` file present.
### Django `migraterollback` command
❯ python manage.py migraterollback polls feature/really-cool-branch
Attempting to go back to rollback polls to latest migration on branch feature/really-cool-branch
Operations to perform:
Target specific migration: 0006_question5, from polls
Running migrations:
Rendering model states...
DONE
Unapplying polls.0007_question6...
OK
This command is used to migrate a Django app back to the migration found in a repository's branch (this will also migrate to that migration if behind).
* An app must be specified as the first argument after the command to indicate which app you wish to rollback.
* By default if no argument is specified after the app, the branch `main` will be used.
### Django `migrateprevious` command
❯ python manage.py migrateprevious polls
Attempting to go back to rollback polls to previous migration
Operations to perform:
Target specific migration: 0005_question4, from polls
Running migrations:
Rendering model states...
DONE
Unapplying polls.0006_question5...
OK
This command is used to migrate a Django app back to the previously applied migration.
* An app must be specified as the first argument after the command to indicate which app you wish to migrate to the previously applied migration.
## Installing
### From PyPi
```
pip install django-migration-rollback
```
### From GitHub
```
pip install git+ssh://git@github.com/jdboisvert/django-migration-rollback
```
### Quick start
Add "migration_rollback" to your INSTALLED_APPS in the `settings.py` like this:
```
INSTALLED_APPS = [
...
'migration_rollback',
]
```
### Development
## Getting started
```bash
# install pyenv (if necessary)
brew install pyenv pyenv-virtualenv
echo """
export PYENV_VIRTUALENV_DISABLE_PROMPT=1
eval "$(pyenv init --path)"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
""" > ~/.zshrc
source ~/.zshrc
# create a virtualenv
pyenv install 3.10.5
pyenv virtualenv 3.10.5 django_migration_rollback
pyenv activate django_migration_rollback
# install dependencies
pip install -U pip
pip install -r requirements.txt -r requirements_dev.txt
```
## Installing pre-commit hooks
```bash
pre-commit install
```
Raw data
{
"_id": null,
"home_page": "https://github.com/jdboisvert/django-migration-rollback",
"name": "django-migration-rollback",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8.0",
"maintainer_email": "",
"keywords": "django,migration,rollback,git",
"author": "Jeffrey Boisvert",
"author_email": "info.jeffreyboisvert@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/7a/84/78bfda70be1e3bccc141fb9794fd1b3f17adc983d1cbad775b7b299c8025/django-migration-rollback-1.0.5.tar.gz",
"platform": "any",
"description": "# Django Migration Rollback v1.0.5\nA Django package used to just make the `python manage.py migrate` a little easier for Django apps that commit their migrations and want a way to rollback to a previous migration without needing to check what the which one it is via `python manage.py showmigrations` or in the project's git repository.\n\n## Features\nAble to set which branch in a git repository to rollback to using the custom command `migraterollback` or if you wish to just rollback to a previous migration only via `migrateprevious`. Note in order to use the rollback with a git repository's branch feature with git the project must have a `.git` file present.\n\n### Django `migraterollback` command\n \u276f python manage.py migraterollback polls feature/really-cool-branch\n Attempting to go back to rollback polls to latest migration on branch feature/really-cool-branch\n Operations to perform:\n Target specific migration: 0006_question5, from polls\n Running migrations:\n Rendering model states...\n DONE\n Unapplying polls.0007_question6...\n OK\n\nThis command is used to migrate a Django app back to the migration found in a repository's branch (this will also migrate to that migration if behind).\n\n* An app must be specified as the first argument after the command to indicate which app you wish to rollback.\n* By default if no argument is specified after the app, the branch `main` will be used.\n\n### Django `migrateprevious` command\n \u276f python manage.py migrateprevious polls\n Attempting to go back to rollback polls to previous migration\n Operations to perform:\n Target specific migration: 0005_question4, from polls\n Running migrations:\n Rendering model states...\n DONE\n Unapplying polls.0006_question5...\n OK\n\nThis command is used to migrate a Django app back to the previously applied migration.\n\n* An app must be specified as the first argument after the command to indicate which app you wish to migrate to the previously applied migration.\n\n## Installing\n### From PyPi\n```\npip install django-migration-rollback\n```\n\n### From GitHub\n```\npip install git+ssh://git@github.com/jdboisvert/django-migration-rollback\n```\n\n### Quick start\nAdd \"migration_rollback\" to your INSTALLED_APPS in the `settings.py` like this:\n```\n INSTALLED_APPS = [\n ...\n 'migration_rollback',\n ]\n```\n\n### Development\n\n## Getting started\n```bash\n# install pyenv (if necessary)\nbrew install pyenv pyenv-virtualenv\necho \"\"\"\nexport PYENV_VIRTUALENV_DISABLE_PROMPT=1\neval \"$(pyenv init --path)\"\neval \"$(pyenv init -)\"\neval \"$(pyenv virtualenv-init -)\"\n\"\"\" > ~/.zshrc\nsource ~/.zshrc\n\n# create a virtualenv\npyenv install 3.10.5\npyenv virtualenv 3.10.5 django_migration_rollback\npyenv activate django_migration_rollback\n\n# install dependencies\npip install -U pip\npip install -r requirements.txt -r requirements_dev.txt\n```\n\n## Installing pre-commit hooks\n```bash\npre-commit install\n```\n\n\n",
"bugtrack_url": null,
"license": "MIT License",
"summary": "A simple Django app to be able to migrate back to a previous migration or to migrate back to a migration in a specific branch in a git repository or locally.",
"version": "1.0.5",
"project_urls": {
"Bug Reports": "https://github.com/jdboisvert/django-migration-rollback/issues",
"Download": "https://github.com/jdboisvert/django-migration-rollback/archive/refs/tags/v1.0.5.zip",
"Homepage": "https://github.com/jdboisvert/django-migration-rollback",
"Repository": "https://github.com/jdboisvert/django-migration-rollback"
},
"split_keywords": [
"django",
"migration",
"rollback",
"git"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "a2da20d7ddcff11f4c3ca29263ab262b417ab177c43ea6bff51366f52b295f31",
"md5": "97641a2855ff0f7b74f19400c1fba43a",
"sha256": "434ad910e5cf22924794422ae61777d82864bdae49492d0595ba065f05a964a1"
},
"downloads": -1,
"filename": "django_migration_rollback-1.0.5-py3-none-any.whl",
"has_sig": false,
"md5_digest": "97641a2855ff0f7b74f19400c1fba43a",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8.0",
"size": 6655,
"upload_time": "2023-07-28T02:57:00",
"upload_time_iso_8601": "2023-07-28T02:57:00.626947Z",
"url": "https://files.pythonhosted.org/packages/a2/da/20d7ddcff11f4c3ca29263ab262b417ab177c43ea6bff51366f52b295f31/django_migration_rollback-1.0.5-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "7a8478bfda70be1e3bccc141fb9794fd1b3f17adc983d1cbad775b7b299c8025",
"md5": "df1556a235a0db34666c848cb8e59901",
"sha256": "bb3c9fbebaf2947473b0ab53ebefbd3b23fbeb492a2ce3aa24c2ef79cf9ddcbd"
},
"downloads": -1,
"filename": "django-migration-rollback-1.0.5.tar.gz",
"has_sig": false,
"md5_digest": "df1556a235a0db34666c848cb8e59901",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8.0",
"size": 5913,
"upload_time": "2023-07-28T02:57:03",
"upload_time_iso_8601": "2023-07-28T02:57:03.153646Z",
"url": "https://files.pythonhosted.org/packages/7a/84/78bfda70be1e3bccc141fb9794fd1b3f17adc983d1cbad775b7b299c8025/django-migration-rollback-1.0.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-07-28 02:57:03",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "jdboisvert",
"github_project": "django-migration-rollback",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "django-migration-rollback"
}