RESOLVED FIXED 196252
[ews-app] Set db_constraint to False for Foreign Keys
https://bugs.webkit.org/show_bug.cgi?id=196252
Summary [ews-app] Set db_constraint to False for Foreign Keys
Aakash Jain
Reported 2019-03-26 06:26:38 PDT
Steps table have a ForeignKey build_uid. Since the Build and step events from Buildbot can arrive out of order, we might get step data before build data. In that case, we still want to save the step data. For sqlite Django seems to allow this by default. However, after switching to PostgreSQL, Django is throwing below exception. We should set ForeignKey.db_constraint=False to allow this condition. Step(step_uid, build_uid, result, state_string, started_at, complete_at).save() File "/Library/Python/2.7/site-packages/django/db/models/base.py", line 808, in save force_update=force_update, update_fields=update_fields) File "/Library/Python/2.7/site-packages/django/db/models/base.py", line 838, in save_base updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields) File "/Library/Python/2.7/site-packages/django/db/transaction.py", line 223, in __exit__ connection.commit() File "/Library/Python/2.7/site-packages/django/db/backends/base/base.py", line 262, in commit self._commit() File "/Library/Python/2.7/site-packages/django/db/backends/base/base.py", line 236, in _commit return self.connection.commit() File "/Library/Python/2.7/site-packages/django/db/utils.py", line 94, in __exit__ six.reraise(dj_exc_type, dj_exc_value, traceback) File "/Library/Python/2.7/site-packages/django/db/backends/base/base.py", line 236, in _commit return self.connection.commit() IntegrityError: insert or update on table "ews_step" violates foreign key constraint "ews_step_build_uid_3e89afad_fk_ews_build_uid" DETAIL: Key (build_uid)=(1_336) is not present in table "ews_build".
Attachments
Patch (1.98 KB, patch)
2019-03-26 06:27 PDT, Aakash Jain
no flags
Aakash Jain
Comment 1 2019-03-26 06:27:48 PDT
WebKit Commit Bot
Comment 2 2019-03-26 10:13:35 PDT
Comment on attachment 365962 [details] Patch Clearing flags on attachment: 365962 Committed r243502: <https://trac.webkit.org/changeset/243502>
WebKit Commit Bot
Comment 3 2019-03-26 10:13:37 PDT
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 4 2019-03-26 10:15:05 PDT
Note You need to log in before you can comment on or make changes to this bug.