{"id":17003519,"url":"https://github.com/kennethlove/django-drifter","last_synced_at":"2025-05-07T13:25:41.764Z","repository":{"id":255561876,"uuid":"851944843","full_name":"kennethlove/django-drifter","owner":"kennethlove","description":"A small Django utility to make it easier to revert and redo migrations or to recreate your database.","archived":false,"fork":false,"pushed_at":"2024-09-26T19:49:21.000Z","size":52,"stargazers_count":65,"open_issues_count":2,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-01-03T07:20:06.503Z","etag":null,"topics":["django","migrations"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kennethlove.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.txt","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-09-04T00:36:16.000Z","updated_at":"2024-12-05T14:43:03.000Z","dependencies_parsed_at":"2024-10-14T04:41:32.122Z","dependency_job_id":null,"html_url":"https://github.com/kennethlove/django-drifter","commit_stats":null,"previous_names":["kennethlove/django-migration","kennethlove/django-drifter"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kennethlove%2Fdjango-drifter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kennethlove%2Fdjango-drifter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kennethlove%2Fdjango-drifter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kennethlove%2Fdjango-drifter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kennethlove","download_url":"https://codeload.github.com/kennethlove/django-drifter/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":233347528,"owners_count":18662680,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["django","migrations"],"created_at":"2024-10-14T04:31:30.674Z","updated_at":"2025-01-10T12:43:44.085Z","avatar_url":"https://github.com/kennethlove.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Django Drifter Project\n\n_*Currently only supports PostgreSQL*_\n\n## Overview\n\nThe Drifter project provides custom Django management commands to\nmanage database migrations. It includes commands to revert and redo\nmigrations for a specified app or the entire project.\n\nThese commands are most useful during development and so cannot be\nrun in production (`DEBUG = False`).\n\n## Features\n\n- **Revert Migration**: Reverts one or more migrations, optionally for a specified app.\n- **Redo Migration**: Reverts and re-applies the last migration, optionally for a specified app.\n- **Reset Database**: Drops all tables and runs all migrations.\n\n## Installation\n\n1. Install the package:\n   ```sh\n   pip install django-drifter\n   ```\n2. Add `drifter` to the `INSTALLED_APPS` setting in your Django project's `settings.py` file:\n   ```python\n   INSTALLED_APPS = [\n       \"drifter\",\n       ...,\n   ]\n   ```\n\n## Usage\n\n### Revert Migration\n\nThe `revert_migration` command reverts the last migration for a specified app.\n\n```sh\npython manage.py revert_migration [app_name] [--num N]\n```\n\n- `app_name`: The name of the app whose migration you want to revert.\n- `--num N`: (Optional) The number of migrations to revert. Defaults to 1.\n\n### Redo Migration\n\nThe `redo_migration` command undoes and redoes the last migration for a specified app.\n\n```sh\npython manage.py redo_migration [--app app_name]\n```\n\n- `--app app_name`: (Optional) The name of the app whose migration you want to redo.\n \n### Reset Database\n\nThe `reset_database` command drops all tables and runs all migrations.\n\n```sh\npython manage.py reset_database [--yes]\n```\n\n- `--yes`: (Optional) Skips the confirmation prompt.\n\n## Running Tests\n\nBefore running the tests, start a local Postgres database:\n\n```shell\ndocker run --name drifter-postgres -e POSTGRES_USER=django -e POSTGRES_PASSWORD=django -p 5432:5432 -d polls\n```\n\nTo run the tests, use the following command:\n\n```sh\npytest\n```\n\n## Example\n\n### Revert Migration Example\n\n```sh\npython manage.py revert_migration polls --num 2\n```\n\nThis command reverts the last two migrations for the `polls` app.\n\n### Redo Migration Example\n\n```sh\npython manage.py redo_migration --app polls\n```\n\nThis command redoes the last migration for the `polls` app.\n\n### Reset Database Example\n\n```sh\npython manage.py reset_database\n```\n\nThis command drops all tables and runs all migrations.\n\n## Contributing\n\nContributions are more than welcome! Please follow these steps to contribute:\n\n1. Fork the repository.\n2. Create a new branch (`git checkout -b feature-branch`).\n3. Make your changes.\n4. Commit your changes (`git commit -am 'Add new feature'`).\n5. Push to the branch (`git push origin feature-branch`).\n6. Create a new Pull Request.\n\n## License\n\nThis project is licensed under the Apache 2.0 License. See the `LICENSE` file for more details.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkennethlove%2Fdjango-drifter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkennethlove%2Fdjango-drifter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkennethlove%2Fdjango-drifter/lists"}