Skip to content
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

Update the data type of AssetType in trustline tables #268

Merged
merged 5 commits into from
Jul 22, 2024

Conversation

amishas157
Copy link
Contributor

@amishas157 amishas157 commented Jul 16, 2024

PR Checklist

PR Structure

  • This PR has reasonably narrow scope (if not, break it down into smaller PRs).
  • This PR avoids mixing refactoring changes with feature changes (split into two PRs
    otherwise).
  • This PR's title starts with the jira ticket associated with the PR.

Thoroughness

  • This PR adds tests for the most critical parts of the new functionality or fixes.
  • I've updated the README with the added features, breaking changes, new instructions on how to use the repository. I updated the description of the fuction with the changes that were made.

Release planning

  • I've decided if this PR requires a new major/minor/patch version accordingly to
    semver, and I've changed the name of the BRANCH to release/_ , feature/_ or patch/* .

What

This PR updates the data type of AssetType for Trustlines tables from integer to string.

Why

This is done to make AssetType consistent across all the schemas as it was mistakenly added as integer earlier.

Known limitations

None. Posted the deploy plan in jira

@@ -61,7 +61,7 @@ func TransformTrustline(ledgerChange ingest.Change, header xdr.LedgerHeaderHisto
transformedTrustline := TrustlineOutput{
LedgerKey: outputLedgerKey,
AccountID: outputAccountID,
AssetType: int32(asset.Type),
AssetType: asset.Type.String(),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chowbao I am seeing values like AssetTypeAssetTypePoolShare in the tables
Screenshot 2024-07-19 at 10 26 15 AM

Should it rather be AssetTypePoolShare ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should match how history_assets does it which I think removes AssetTypeAssetType.

You might need to define a new function to make the change or look for an existing if one exists

@amishas157 amishas157 marked this pull request as ready for review July 22, 2024 15:43
@amishas157 amishas157 requested a review from a team as a code owner July 22, 2024 15:43
@amishas157 amishas157 changed the title Update the data type Update the data type of AssetType in trustline tables Jul 22, 2024
@@ -39,12 +39,15 @@ func TransformTrustline(ledgerChange ingest.Change, header xdr.LedgerHeaderHisto
return TrustlineOutput{}, errors.Wrap(err, fmt.Sprintf("could not create ledger key string for trustline with account %s and asset %s", outputAccountID, asset.ToAsset().StringCanonical()))
}

var assetTypeString string
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I think you don't need to create a new variable and can just reuse assetType because it is already a string variable defined on line 33

In any case this is a non blocking suggestion

@amishas157 amishas157 merged commit 741ee9b into master Jul 22, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants