-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix scan error when fetching archived contracts #1585
base: api-breakers
Are you sure you want to change the base?
Conversation
@@ -12,7 +12,7 @@ type Scanner interface { | |||
|
|||
type ContractRow struct { | |||
FCID FileContractID | |||
HostID int64 | |||
HostID *int64 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will a contract ever not be attached to a host where nil would make sense?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we merged contracts
and archived_contracts
into a single contracts
table. If a host we used before goes offline for an extended period of time we remove it (RemoveOfflineHosts
), so it's possible for a row in the contracts table to point to a host that no longer exists.
Edit: sorry, bit too fast on the trigger, we nullify the host_id
when we archive a contract, we do that so we can remove offline hosts without breaking the FK check
This PR fixes a scan error when fetching contracts using the new filter mode
api.ContractFilterModeArchived
.Related #1545