github-mirror icon indicating copy to clipboard operation
github-mirror copied to clipboard

SQL error for missing fork parents

Open jeffmcaffer opened this issue 9 years ago • 2 comments

when ensure_repo runs on a fork, it looks to ensure the parent repo is also present. If it is not or is otherwise not available, then this line breaks with an error trying to relate foreign keys.

This scenario can happen if the parent cannot be loaded. For example, the key in use may not have permissions to that repo or there may be a transient error.

What is the right fix to do here? I have not looked at the database enough to grok all the relationships

jeffmcaffer avatar Oct 09 '16 03:10 jeffmcaffer

Are you sure it breaks at L591? This is within a if parent.nil? guard that should check whether a parent can be retrieved...

gousiosg avatar Oct 13 '16 14:10 gousiosg

Yes. I have since commented out that code but suspect it is actually the -1 that is the problem as I was actually getting a SQL error with the update()

jeffmcaffer avatar Oct 17 '16 15:10 jeffmcaffer