Metadata-Version: 2.4
Name: django-migration-resolver
Version: 0.1.1
Summary: A Django package to track and resolve migration conflicts automatically.
Project-URL: Homepage, https://github.com/WillPoulson/django-migration-resolver
Project-URL: Repository, https://github.com/WillPoulson/django-migration-resolver
Project-URL: Issues, https://github.com/WillPoulson/django-migration-resolver/issues
Author-email: Will Poulson <willpoulson44@gmail.com>
License-Expression: MIT
License-File: LICENCE
Requires-Dist: django>=3.2
Description-Content-Type: text/markdown

# Django Migration Resolver

A Django package to automatically track and resolve migration conflicts between different branches.

## Installation
```sh
pip install django-migration-resolver
```

Add 'django_migration_resolver' to your INSTALLED_APPS

```python
INSTALLED_APPS = [
    ...
    'django_migration_resolver',
    ...
]
```

You must ensure that `django_migration_resolver` is placed before `django.contrib.auth` in the `INSTALLED_APPS` list.

## Usage

For each app in your project, create a file named `latest_migration.txt` in the app's directory. This file should contain the name of the latest migration that has been applied to the database.
**If this file is not created, this package will have no effect on the app.**

After it is created, it will automatically updated by the `makemigrations` command.

```sh
python manage.py makemigrations
```

To aid in resolving the conflicts, a new command `resolvemigrations` has been added. This command will automatically resolve the conflicts by updating dependencies of your new migrations to depend on the latest migrations of the other branches.

When you encounter git conflicts with the `latest_migration.txt` file, accept changes from the branch that has the latest migration applied to the database.
After that run the following command to resolve the multiple leaf nodes that are left.

```sh
python manage.py resolvemigrations
```