Skip to content
This repository has been archived by the owner on Jan 25, 2022. It is now read-only.

Upgrading to django 1.8.7 #7

Closed
xrotwang opened this issue Dec 10, 2015 · 8 comments
Closed

Upgrading to django 1.8.7 #7

xrotwang opened this issue Dec 10, 2015 · 8 comments

Comments

@xrotwang
Copy link
Contributor

This seems to create a lot more problems than the upgrade to 1.7.x, e.g.

@xrotwang
Copy link
Contributor Author

@SimonGreenhill @stefelisabeth I guess, I need help with this from Django experts. Trying to run the app, I get a NameError for some django-select2 thing. Trying to run the tests I get

ProgrammingError: relation "auth_user" does not exist

@SimonGreenhill
Copy link

@xrotwang -- have you tried running "python manage.py migrate auth"?

@SimonGreenhill
Copy link

Actually, reading that django-user-auth issue suggests that upgrading to django-user-auth v1.1 should fix it.

@xrotwang
Copy link
Contributor Author

I've seen that and tried all kinds of migrate. Django-user-auth is not even
installed, so this thread does only apply to the symptoms I'm seeing.
Am 10.12.2015 22:53 schrieb "Simon J Greenhill" [email protected]:

Actually, reading that django-user-auth issue suggests that upgrading to
django-user-auth v1.1 should fix it.


Reply to this email directly or view it on GitHub
#7 (comment).

@SimonGreenhill
Copy link

Odd, try removing all the .pyc files, and then run

./manage.py migrate --fake-initial

@xrotwang
Copy link
Contributor Author

Hm. No luck. Maybe this jazzband/django-oauth-toolkit#204 (comment) is a good lead? Now we'd just need to know, which of the non-core apps pulotu has installed may lack migrations:

    # third-party
    'reversion',  # reversion: object version control.
    'djangosecure',  # django-secure: Security helper
    'django_tables2',  # django-tables2: tables helper
    'watson',  # search
    'compressor',  # django-compressor for asset compression
    'captcha',
    'django_select2',
    # website
    'website.apps.core',  # core functionality
    'website.apps.survey',  # survey

@xrotwang
Copy link
Contributor Author

It's worth noting that this seems to be only a problem for the tests - maybe something goes wrong (possibly in migrations) when creating the test database?

@xrotwang
Copy link
Contributor Author

After some reading about how migrations work in Django, I did the following:

rm website/apps/core/migrations/*
rm website/apps/survey/migrations/*
python manage.py makemigrations core
python manage.py makemigrations survey
python manage.py migrate --fake-initial

i.e. I promoted the current status of the DB model to be the initial one. After this, tests are running fine, as does the app - as far as I tested. So I suspect that the order of migrations in one of the apps was a problem, which only appeared in tests, because only then "old" migrations would be run. So I'd consider this issue fixed - or are there any problems with this approach?

I also think for apps that are supposed to only have one running instance, this process of starting out with a clean slate (by throwing out historical code) makes a lot of sense when doing major upgrades, because in these cases, there will be no smooth rollback option anyway.

xrotwang added a commit that referenced this issue Dec 14, 2015
This upgrade includes

- upgrading requirements
- rebasing the database model at the current status quo, i.e. replacing
  historical migrations with one big new initial migration
- small code changes to prepare transition to Django 1.9

Closes #7
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants