Anomalie #3098
ferméCRASH when adding OPE
0%
Description
Seens on paleosystem freshly updated : crash at the end of add wizard
Seems to be linked to a newly added type of OPE.
IntegrityError at /operation_creation/done
ERREUR: une instruction insert ou update sur la table « archaeological_operations_operation » viole la contrainte de clé
étrangère « operation_type_id_refs_id_42550446d799660b »
DETAIL: La clé (operation_type_id)=(4) n'est pas présente dans la table « archaeological_operations_operationtypeold ».
Request Method: GET
Request URL: http://ishtar-nhi.paleosystem.fr/operation_creation/done
Django Version: 1.4.5
Exception Type: IntegrityError
Exception Value:
ERREUR: une instruction insert ou update sur la table « archaeological_operations_operation » viole la contrainte de clé
étrangère « operation_type_id_refs_id_42550446d799660b »
DETAIL: La clé (operation_type_id)=(4) n'est pas présente dans la table « archaeological_operations_operationtypeold ».
Exception Location: /usr/lib/python2.7/dist-packages/django/db/backends/postgresql_psycopg2/base.py in _commit, line 235
Python Executable: /usr/bin/uwsgi-core
Python Version: 2.7.3
Python Path:
['/srv/ishtar-NHI/ishtar/',
'.',
'',
'/usr/lib/python2.7',
'/usr/lib/python2.7/plat-linux2',
'/usr/lib/python2.7/lib-tk',
'/usr/lib/python2.7/lib-old',
'/usr/lib/python2.7/lib-dynload',
'/usr/local/lib/python2.7/dist-packages',
'/usr/lib/python2.7/dist-packages',
'/usr/lib/python2.7/dist-packages/PIL',
'/usr/lib/python2.7/dist-packages/gtk-2.0',
'/usr/lib/pymodules/python2.7']
Server time: jeu, 21 Avr 2016 20:54:32 +0200
Traceback:
File "/usr/lib/python2.7/dist-packages/django/core/handlers/base.py" in get_response
- response = callback(request, *callback_args, **callback_kwargs)
File "/srv/ishtar-NHI/ishtar/ishtar_common/wizards.py" in _wrapped_view
- return view_func(request, *args, **kwargs)
File "/usr/lib/python2.7/dist-packages/django/views/generic/base.py" in view
- return self.dispatch(request, *args, **kwargs)
File "/srv/ishtar-NHI/ishtar/ishtar_common/wizards.py" in dispatch
- return super(Wizard, self).dispatch(request, *args, **kwargs)
File "/usr/lib/python2.7/dist-packages/django/contrib/formtools/wizard/views.py" in dispatch
- response = super(WizardView, self).dispatch(request, *args, **kwargs)
File "/usr/lib/python2.7/dist-packages/django/views/generic/base.py" in dispatch
- return handler(request, *args, **kwargs)
File "/usr/lib/python2.7/dist-packages/django/contrib/formtools/wizard/views.py" in get
- ), **kwargs)
File "/usr/lib/python2.7/dist-packages/django/contrib/formtools/wizard/views.py" in render_done
- return super(NamedUrlWizardView, self).render_done(form, **kwargs)
File "/usr/lib/python2.7/dist-packages/django/contrib/formtools/wizard/views.py" in render_done
- done_response = self.done(final_form_list, **kwargs)
File "/srv/ishtar-NHI/ishtar/ishtar_common/wizards.py" in done
- return_object)
File "/srv/ishtar-NHI/ishtar/ishtar_common/wizards.py" in save_model
- obj.save()
File "/srv/ishtar-NHI/ishtar/archaeological_operations/models.py" in save
- return super(Operation, self).save(*args, **kwargs)
File "/srv/ishtar-NHI/ishtar/ishtar_common/models.py" in save
- super(BaseHistorizedItem, self).save(*args, **kwargs)
File "/usr/lib/python2.7/dist-packages/django/db/models/base.py" in save
- self.save_base(using=using, force_insert=force_insert, force_update=force_update)
File "/usr/lib/python2.7/dist-packages/django/db/models/base.py" in save_base
- transaction.commit_unless_managed(using=using)
File "/usr/lib/python2.7/dist-packages/django/db/transaction.py" in commit_unless_managed
- connection.commit_unless_managed()
File "/usr/lib/python2.7/dist-packages/django/db/backends/init.py" in commit_unless_managed
- self._commit()
File "/usr/lib/python2.7/dist-packages/django/db/backends/postgresql_psycopg2/base.py" in _commit
- return self.connection.commit()
Exception Type: IntegrityError at /operation_creation/done
Exception Value: ERREUR: une instruction insert ou update sur la table « archaeological_operations_operation » viole la contrainte de clé
étrangère « operation_type_id_refs_id_42550446d799660b »
DETAIL: La clé (operation_type_id)=(4) n'est pas présente dans la table « archaeological_operations_operationtypeold ».
Mis à jour par Étienne Loks il y a plus de 8 ans
- Statut changé de Nouveau à Résolu
Bad migration on some instances. This should be fixed.
To fix it manualy. Connect to the database. With \d archaeological_operations_operation
get the name of the foreign key constraint regarding operation_type_id (something like operation_type_id_refs_id_42550446d799660b) and drop the constraint:
ALTER TABLE archaeological_operations_operation DROP CONSTRAINT operation_type_id_refs_id_42550446d799660b;
And recreate it:
ALTER TABLE archaeological_operations_operation
ADD CONSTRAINT operation_type_id_refs_id_123456789
FOREIGN KEY (operation_type_id) REFERENCES ishtar_common_operationtype (id) MATCH FULL;