我正在使用db:push
將我的數據庫從sqlite轉換爲postgres,將我的Django應用程序的數據庫上傳到Heroku。將sqlite數據庫轉換爲postgres產生DatabaseError:值太長,因爲字符變化(50)
但是,過程中我得到的錯誤:
Taps Server Error: PGError: ERROR: integer out of range
當我嘗試使用python manage.py syncdb
創建Heroku的服務器上一個乾淨的數據庫,我得到類似的消息:
Installing index for django_openid.UserOpenidAssociation model
Installing json fixture 'initial_data' from '/app/.heroku/venv/lib/python2.7/site- packages/oembed/fixtures'.
Installing json fixture 'initial_data' from '/app/.heroku/venv/lib/python2.7/site- packages/pinax/apps/photos/fixtures'.
Installing json fixture 'initial_data' from '/app/store/fixtures'.
Problem installing fixture '/app/store/fixtures/initial_data.json': Traceback (most recent call last):
File "/app/.heroku/venv/lib/python2.7/site-packages/django/core/management/commands/loaddata.py", line 169, in handle
obj.save(using=using)
File "/app/.heroku/venv/lib/python2.7/site-packages/django/core/serializers/base.py", line 165, in save
models.Model.save_base(self.object, using=using, raw=True)
File "/app/.heroku/venv/lib/python2.7/site-packages/django/db/models/base.py", line 501, in save_base
rows = manager.using(using).filter(pk=pk_val)._update(values)
File "/app/.heroku/venv/lib/python2.7/site-packages/django/db/models/query.py", line 491, in _update
return query.get_compiler(self.db).execute_sql(None)
File "/app/.heroku/venv/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 861, in execute_sql
cursor = super(SQLUpdateCompiler, self).execute_sql(result_type)
File "/app/.heroku/venv/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 727, in execute_sql
cursor.execute(sql, params)
File "/app/.heroku/venv/lib/python2.7/site-packages/django/db/backends/util.py", line 15, in execute
return self.cursor.execute(sql, params)
File "/app/.heroku/venv/lib/python2.7/site-packages/django/db/backends/postgresql_psycopg2/base.py", line 44, in execute
return self.cursor.execute(query, args)
DatabaseError: value too long for type character varying(50)
它看起來問題在於最初的數據,但不完全確定。我在這裏發現了一篇文章,說這可能是一個字段編碼的問題,但即使我正在研究那些不完全確定如何讀取錯誤信息以找出究竟是什麼導致了問題,還要找出哪個表/列可能會導致問題。
你有你的sqlite數據庫的DDL嗎?怎麼樣postgresql數據庫?你也可以發佈這個嗎? – swasheck