← Back to team overview

graphite-dev team mailing list archive

[Question #692978]: table "django_content_type" already exists

 

New question #692978 on Graphite:
https://answers.launchpad.net/graphite/+question/692978

Hi,

I am trying to upgrade graphite from version 0.9.15 to 1.1.7

Initially this has worked as a clean install only by removing the existing /opt/graphite directory and upgrading python(2->3.x), sqlite, mod_wsgi, whisper, carbon and graphite-web.

I now need to upgrade this for production purposes and therefore need to persist all db data and attempt to upgrade in-place without removing the existing installation.

When I get to the Django webapp db setup steps I am having issues running the django-admin.py commands. I have run 

export DJANGO_SETTINGS_MODULE=graphite.settings
export PYTHONPATH=/opt/graphite/webapp

/usr/local/bin/django-admin.py collectstatic
709 static files copied to '/opt/graphite/static'.

/usr/local/bin/django-admin.py makemigrations
Migrations for 'account':
  /opt/graphite/webapp/graphite/account/migrations/0002_auto_20200917_1608.py
    - Alter field history on profile
Migrations for 'events':
  /opt/graphite/webapp/graphite/events/migrations/0002_auto_20200917_1608.py
    - Alter field tags on event

When I run the migrate command I get the following error:

/usr/local/bin/django-admin.py migrate --run-syncdb
Operations to perform:
  Synchronize unmigrated apps: browser, composer, functions, messages, metrics, render, staticfiles, whitelist
  Apply all migrations: account, admin, auth, contenttypes, dashboard, events, sessions, tagging, tags, url_shortener
Synchronizing apps without migrations:
  Creating tables...
    Running deferred SQL...
Running migrations:
  Applying contenttypes.0001_initial...Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql)
  File "/usr/local/lib/python3.8/site-packages/django/db/backends/sqlite3/base.py", line 394, in execute
    return Database.Cursor.execute(self, query)
sqlite3.OperationalError: table "django_content_type" already exists

I have read that using --fake-initial can help... but I run into similar exception albeit against a different table

/usr/local/bin/django-admin.py migrate --fake-initial --run-syncdb
Operations to perform:
  Synchronize unmigrated apps: browser, composer, functions, messages, metrics, render, staticfiles, whitelist
  Apply all migrations: account, admin, auth, contenttypes, dashboard, events, sessions, tagging, tags, url_shortener
Synchronizing apps without migrations:
  Creating tables...
    Running deferred SQL...
Running migrations:
  Applying dashboard.0001_initial...Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql)
  File "/usr/local/lib/python3.8/site-packages/django/db/backends/sqlite3/base.py", line 394, in execute
    return Database.Cursor.execute(self, query)
sqlite3.OperationalError: table "dashboard_dashboard" already exists

Is it even possible to migrate the data between these versions - 0.9.15 to 1.1.7 ?

Regards


-- 
You received this question notification because your team graphite-dev
is an answer contact for Graphite.