#Database not apply my migrations
30 messages · Page 1 of 1 (latest)
I think it's not a good idea to use "migrate card zero" but i don't see any solutions
@mild hearth start with checking your migrations files, is there one that adds this field?
--fake is otherway around - it doesn't change db
if you faked migration before it would be the reason
then rolling back with --fake should work
Operations to perform:
Apply all migrations: admin, ads, auth, card, contenttypes, documentation, flatpages, member, sessions, sites, thumbnail
Running migrations:
No migrations to apply.```
heu..so many command, probably all
yeah, I tried many command then all migraitons are faked
Operations to perform:
Target specific migration: 0001_initial, from card
Running migrations:
Rendering model states... DONE
Unapplying card.0003_alter_amphibian_main_mores_and_more... OK
Unapplying card.0002_reproductionperiod_amphibian_reproduction_and_more...Traceback (most recent call last):
File "/home/terrariopedia/.production/lib/python3.11/site-packages/django/db/backends/utils.py", line 87, in _execute
return self.cursor.execute(sql)```
... ```django.db.utils.ProgrammingError: column "reproduction" of relation "card_turtle" does not exist```
manage.py migrate card 0002
manage.py migrate card 0001 --fake
looks like 0002 is either faked or incorrectly applied
Operations to perform:
Target specific migration: 0002_reproductionperiod_amphibian_reproduction_and_more, from card
Running migrations:
(.production) terrariopedia@ssh1:~/production$ python manage.py migrate card 0001 --fake
Operations to perform:
Target specific migration: 0001_initial, from card
Running migrations:
Rendering model states... DONE
Unapplying card.0002_reproductionperiod_amphibian_reproduction_and_more... FAKED
(.production) terrariopedia@ssh1:~/production$```
now question is in what state is migration 0001
again, better connect to your dbms and check tables
How can I do that ?
either manage.py dbshell or use a side tool that can work with your db, like DBeaver, PGadmin, don't remember what are options for SQLite if it's your case
dbshell open db console you need lookup syntax that lists tables for your db