Closed matijapretnar closed 1 year ago
Migracij nisem peštal (squashmigrations
), ampak sem jih raje resetiral, da ne vlečemo naokoli starih smeti. Za migracije sem sledil navodilom na https://raturi.in/blog/how-reset-django-migrations/. Najprej sem preveril, da makemigrations
ne naredi nobene nove migracije in da migrate
ne izvede nobene migracije. Torej je baza usklajena s kodo.
tomo@d22a54139ea4:/workspace/web$ ./manage.py makemigrations
No changes detected
tomo@d22a54139ea4:/workspace/web$ ./manage.py migrate
Operations to perform:
Apply all migrations: admin, attempts, auth, authtoken, contenttypes, courses, problems, sessions, social_django, taggit, users
Running migrations:
No migrations to apply.
Nato sem za vse naše štiri aplikacije (attempts
, courses
, problems
, users
) pognal migrate --fake app_name zero
, da sem Django pretental, da ni bila pognana še nobena migracija.
tomo@d22a54139ea4:/workspace/web$ python manage.py migrate --fake attempts zero
Operations to perform:
Unapply all migrations: attempts
Running migrations:
Rendering model states... DONE
Unapplying attempts.0010_alter_historicalattempt_options_and_more... FAKED
Unapplying attempts.0009_historicalattempt_history_change_reason... FAKED
...
Unapplying attempts.0003_make_feedback_string_list... FAKED
Unapplying attempts.0002_rename_accepted_to_valid... FAKED
Unapplying attempts.0001_initial... FAKED
tomo@d22a54139ea4:/workspace/web$ python manage.py migrate --fake courses zero
Operations to perform:
Unapply all migrations: courses
Running migrations:
Rendering model states... DONE
Unapplying problems.0020_alter_historicalpart_options_and_more... FAKED
Unapplying problems.0019_auto_20221022_1604... FAKED
...
Unapplying courses.0003_auto_20150814_0805... FAKED
Unapplying courses.0002_auto_20150805_1700... FAKED
Unapplying courses.0001_initial... FAKED
tomo@d22a54139ea4:/workspace/web$ python manage.py migrate --fake problems zero
Operations to perform:
Unapply all migrations: problems
Running migrations:
Rendering model states... DONE
Unapplying problems.0003_historicalpart_historicalproblem... FAKED
Unapplying problems.0002_add_secret_validator... FAKED
Unapplying problems.0001_initial... FAKED
tomo@d22a54139ea4:/workspace/web$ python manage.py migrate --fake users zero
Operations to perform:
Unapply all migrations: users
Running migrations:
Rendering model states... DONE
Unapplying users.0006_auto_20221022_1604... FAKED
Unapplying users.0005_auto_20190328_1457... FAKED
...
Unapplying admin.0002_logentry_remove_auto_add... FAKED
Unapplying admin.0001_initial... FAKED
Unapplying users.0001_initial... FAKED
Potem sem ročno pobrisal vse migracije in nove naredil od začetka.
tomo@d22a54139ea4:/workspace/web$ python manage.py makemigrations
Migrations for 'attempts':
attempts/migrations/0001_initial.py
- Create model Attempt
- Create model HistoricalAttempt
attempts/migrations/0002_initial.py
- Add field history_user to historicalattempt
- Add field part to historicalattempt
- Add field user to historicalattempt
- Add field part to attempt
- Add field user to attempt
- Alter unique_together for attempt (1 constraint(s))
...
Migrations for 'users':
users/migrations/0001_initial.py
- Create model User
Na koncu sem z migrate --fake
Django pretental, da so vse migracije že narejene (kar je tudi res, saj se baza vmes ni spreminjala). Na https://raturi.in/blog/how-reset-django-migrations/ so navodila drugačna, tam je samo --fake-initial
, ampak po mojem ni hujše škode.
tomo@d22a54139ea4:/workspace/web$ python manage.py migrate --fake
Operations to perform:
Apply all migrations: admin, attempts, auth, authtoken, contenttypes, courses, problems, sessions, social_django, taggit, users
Running migrations:
Applying users.0001_initial... FAKED
Applying admin.0001_initial... FAKED
Applying admin.0002_logentry_remove_auto_add... FAKED
...
Applying social_django.0008_partial_timestamp... FAKED
Applying social_django.0009_auto_20191118_0520... FAKED
Applying social_django.0010_uid_db_index... FAKED
Nato sem še pognal test
in runserver
ter preveril, da vse dela brez težav.
Imam dump anonimizirane postgres baze, ki je velika cca. 80 MB. Kakšna ideja, kam jo lahko naložim za zainteresirane? Fixture je pa precej večji, bi bilo treba podatke še malo oklestiti, preden se jih da uporabljati.
Aja, pa razvoj poteka na https://github.com/ul-fmf/projekt-tomo/tree/razvojno-okolje.
requirements.txt
speštaj migracije