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".
Created attachment 365962 [details] Patch
Comment on attachment 365962 [details] Patch Clearing flags on attachment: 365962 Committed r243502: <https://trac.webkit.org/changeset/243502>
All reviewed patches have been landed. Closing bug.
<rdar://problem/49278115>