3

Something seems to be occurring with my django app. There are two models, one where I altered and the other a new addition. Ever since these two changes my makemigrations and migrate has continued to be the same changed with the migration number incrementing. When I makemigrations:

Migrations for 'om':
  0033_auto_20200122_0001.py:
    - Alter field delivery_date on growerpurchaseorderitem
Migrations for 'accounts':
  0105_auto_20200122_0001.py:
    - Alter field created on pushtoken
    - Alter field push_token on pushtoken

And when I migrate

Synchronizing apps without migrations:
  Creating tables...
    Running deferred SQL...
  Installing custom SQL...
Running migrations:
  Rendering model states... DONE
  Applying accounts.0105_auto_20200122_0001... OK
  Applying om.0033_auto_20200122_0001... OK

I have tried to fake a migration to get past this but no luck. It is an issue as any new changes are not registering to my models.

EDIT:

Show migrations:

for my om

[X] 0030_auto_20200121_2339
 [X] 0031_auto_20200121_2343
 [X] 0032_auto_20200121_2348
 [X] 0033_auto_20200122_0001

for my accounts

[X] 0099_certpdf_expiration_date
 [X] 0100_pushtoken
 [X] 0101_auto_20200121_2145
 [X] 0102_auto_20200121_2339
 [X] 0103_auto_20200121_2343
 [X] 0104_auto_20200121_2348
 [X] 0105_auto_20200122_0001
Andy Nguyen
  • 451
  • 5
  • 17

2 Answers2

2

According to my research, this is most likely the point where the program gets awry:

Synchronizing apps without migrations:

Try creating the migrations and then fake the first migration:

python manage.py makemigrations <app_name>
python manage.py migrate --fake-initial

Where the commands will skip any migration where the tables were already created.

P.S. If you don't know what fake migrations are, check out the explanation.

crimsonpython24
  • 2,223
  • 2
  • 11
  • 27
0

Whatever the problem with migrate, just delete lastly auto created files in the migrations folder and do it again.

You can also edit it directly and run:

python manage.py makemigrations

python manage.py migrate
Antoine
  • 1,393
  • 4
  • 20
  • 26