# Depreciated function in migrations files (index\_together)

**URL:** https://forum.djangoproject.com/t/depreciated-function-in-migrations-files-index-together/33757
**Category:** Using Django
**Created:** [August 11, 2024, 3:45pm UTC](https://forum.djangoproject.com/t/depreciated-function-in-migrations-files-index-together/33757 "2024-08-11T15:45:03Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![rocjojo](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/rocjojo/32/15813_2.png) [@rocjojo](https://forum.djangoproject.com/u/rocjojo)
#### Post date: [August 11, 2024, 3:45pm UTC](https://forum.djangoproject.com/t/depreciated-function-in-migrations-files-index-together/33757/1 "2024-08-11T15:45:03Z")

</div>

Hello,

In one of my project the initial migration (0001) contains the index\_together clause. The model as been modified in the 0002 migration and the index has been deleted. So the index\_together makes no sens anymore even for new project installations (basically it’ an index creation in the 0001 and an index deletion in 0002).

The problem is that during the UnitTest each and every migrations files are executed, and since the index\_together is no longer available in Django 5.1 an error is raised when applying the 0001 migration file.

My question is the following : is it okay/safe to edit the early migrations file (0001 and 0002) to remove the index\_together clause ? Or maybe try to squash them ? (I don’t know how a create/delete of an index is handled during a squash)

Thanks for your tips and for your help.

Kind Regards.

Joel

---

<div class="post-metadata">

### Author: ![white-seolpyo](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/white-seolpyo/32/22386_2.png) [@white-seolpyo](https://forum.djangoproject.com/u/white-seolpyo)
#### Post date: [August 12, 2024, 12:19am UTC](https://forum.djangoproject.com/t/depreciated-function-in-migrations-files-index-together/33757/2 "2024-08-12T00:19:03Z")

</div>

There is a project that has already been written, and I think the problem occurred because only the Django version was upgraded.  
I think you can remove all migrations and add a fake option.

Don’t forget to back up before trying.

```auto
delete migrations
python manage.py makemigrations
python manage.py migrate --fake

```
