Art
Art

Reputation: 2335

Don't apply existing migrations for a Django model

I need to tell Django not to apply already existing migrations for a model. Is there a way I can achieve it?

Why: I have some customizations on top of django.contrib.auth. With those, Group model is left unused. However, migrations for it are included into the auth app. Unlike User, Group is not swappable.

Upvotes: 2

Views: 164

Answers (2)

Sardorbek Imomaliev
Sardorbek Imomaliev

Reputation: 15390

You can set MIGRATION_MODULES and django will use migrations from setted directory for app

MIGRATION_MODULES = {'django.contrib.auth': 'local_package'}

Upvotes: 4

Alex
Alex

Reputation: 6037

You can simply edit the migrations files. So, simply comment out the parts you don't want to be applied.

You can also set your Model to be managed=False , but I'm not sure if that is what you need.

Upvotes: 0

Related Questions