python manage py migrate home pilgrim venv venv-gallup local lib pytho

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
$ python manage.py migrate
/home/pilgrim/venv/venv-gallup/local/lib/python2.7/site-packages/sorl/thumbnail/helpers.py:5: DeprecationWarning: django.utils.simplejson is deprecated; use json instead.
from django.utils import simplejson
Running migrations for action_user:
- Nothing to migrate.
- Loading initial data for action_user.
Installed 0 object(s) from 0 fixture(s)
Running migrations for helpers:
- Nothing to migrate.
- Loading initial data for helpers.
Installed 0 object(s) from 0 fixture(s)
Running migrations for gallup:
- Migrating forwards to 0003_auto__del_opros__add_survey__chg_field_answer_opros.
> gallup:0003_auto__del_opros__add_survey__chg_field_answer_opros
FATAL ERROR - The following SQL query failed: ALTER TABLE "gallup_answer" ADD CONSTRAINT "opros_id_refs_id_647d7a4b" FOREIGN KEY ("opros_id") REFERENCES "action_hierarchy_opros" ("id") DEFERRABLE INITIALLY DEFERRED;
The error was: insert or update on table "gallup_answer" violates foreign key constraint "opros_id_refs_id_647d7a4b"
DETAIL: Key (opros_id)=(1) is not present in table "action_hierarchy_opros".
Error in migration: gallup:0003_auto__del_opros__add_survey__chg_field_answer_opros
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/home/pilgrim/venv/venv-gallup/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 399, in execute_from_command_line
utility.execute()
File "/home/pilgrim/venv/venv-gallup/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/pilgrim/venv/venv-gallup/local/lib/python2.7/site-packages/django/core/management/base.py", line 242, in run_from_argv
self.execute(*args, **options.__dict__)
File "/home/pilgrim/venv/venv-gallup/local/lib/python2.7/site-packages/django/core/management/base.py", line 285, in execute
output = self.handle(*args, **options)
File "/home/pilgrim/venv/venv-gallup/local/lib/python2.7/site-packages/south/management/commands/migrate.py", line 111, in handle
ignore_ghosts = ignore_ghosts,
File "/home/pilgrim/venv/venv-gallup/local/lib/python2.7/site-packages/south/migration/__init__.py", line 220, in migrate_app
success = migrator.migrate_many(target, workplan, database)
File "/home/pilgrim/venv/venv-gallup/local/lib/python2.7/site-packages/south/migration/migrators.py", line 254, in migrate_many
result = migrator.__class__.migrate_many(migrator, target, migrations, database)
File "/home/pilgrim/venv/venv-gallup/local/lib/python2.7/site-packages/south/migration/migrators.py", line 329, in migrate_many
result = self.migrate(migration, database)
File "/home/pilgrim/venv/venv-gallup/local/lib/python2.7/site-packages/south/migration/migrators.py", line 133, in migrate
result = self.run(migration, database)
File "/home/pilgrim/venv/venv-gallup/local/lib/python2.7/site-packages/south/migration/migrators.py", line 114, in run
return self.run_migration(migration, database)
File "/home/pilgrim/venv/venv-gallup/local/lib/python2.7/site-packages/south/migration/migrators.py", line 84, in run_migration
migration_function()
File "/home/pilgrim/venv/venv-gallup/local/lib/python2.7/site-packages/south/migration/migrators.py", line 60, in <lambda>
return (lambda: direction(orm))
File "/home/pilgrim/PycharmProjects/gallup/apps/gallup/migrations/0003_auto__del_opros__add_survey__chg_field_answer_opros.py", line 25, in forwards
db.alter_column(u'gallup_answer', 'opros_id', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['gallup.Survey']))
File "/home/pilgrim/venv/venv-gallup/local/lib/python2.7/site-packages/south/db/generic.py", line 47, in _cache_clear
return func(self, table, *args, **opts)
File "/home/pilgrim/venv/venv-gallup/local/lib/python2.7/site-packages/south/db/generic.py", line 555, in alter_column
field.rel.to._meta.get_field(field.rel.field_name).column
File "/home/pilgrim/venv/venv-gallup/local/lib/python2.7/site-packages/south/db/generic.py", line 282, in execute
cursor.execute(sql, params)
File "/home/pilgrim/venv/venv-gallup/local/lib/python2.7/site-packages/django/db/backends/util.py", line 69, in execute
return super(CursorDebugWrapper, self).execute(sql, params)
File "/home/pilgrim/venv/venv-gallup/local/lib/python2.7/site-packages/django/db/backends/util.py", line 53, in execute
return self.cursor.execute(sql, params)
File "/home/pilgrim/venv/venv-gallup/local/lib/python2.7/site-packages/django/db/utils.py", line 99, in __exit__
six.reraise(dj_exc_type, dj_exc_value, traceback)
File "/home/pilgrim/venv/venv-gallup/local/lib/python2.7/site-packages/django/db/backends/util.py", line 53, in execute
return self.cursor.execute(sql, params)
django.db.utils.IntegrityError: insert or update on table "gallup_answer" violates foreign key constraint "opros_id_refs_id_647d7a4b"
DETAIL: Key (opros_id)=(1) is not present in table "action_hierarchy_opros".