So, I'm using Zappa on AWS Lambda. I just added a custom user model to my project and tried to migrate to the RDS on AWS and Zappa gives me the following error:
InconsistentMigrationHistory: Migration admin.0001_initial is applied before its dependency accounts.0001_initial on database 'default'.
Now, I know that if I got this error on my local server, I would do this:
python manage.py migrate admin zero
python manage.py migrate auth zero
python manage.py migrate contenttypes zero
python manage.py migrate sessions zero
I would then run the migrations to destroy their tables and recreate them again (see this helpful SO post)
However, if I ran
zappa manage dev migrate
after that, I get
InconsistentMigrationHistory: Migration admin.0001_initial is applied before its dependency accounts.0001_initial on database
How should I do the same thing on the AWS RDS using Zappa or should I do something else?
I simple destroyed the table using the zappa-django-utils command:
The tricky part was to create a new admin user. Since I replaced the auth model with the accounts model, I had to use the raw python command:
Typically, the custom user model should be implemented before any migrations as many things are related to the User model. So, dropping all the tables were inevitable though I tried to avoid it.