HafSQL v2.7.0: changes for public database users
Removed tables
hafsql.rc_delegations_tableis gone. Use thehafsql.rc_delegationsview, which now reads from balance_tracker.hafsql.proposal_approvals_tableis gone. Use thehafsql.proposal_approvalsview, which now reads from hafbe.
Removed columns from hafsql.accounts_table
reward_hive_balance, reward_hbd_balance, reward_vests_balance, to_withdraw, vesting_withdraw_rate, withdrawn and proxy are gone. The hafsql.accounts view still has all of them under the same names. They now come from balance_tracker / hafbe. If you queried accounts_table directly, switch to the view.
View columns that changed (same names, different values or types)
| View.column | Before | Now |
|---|---|---|
delegations.vests |
raw ×1,000,000 | VESTS, numeric(27,6) |
accounts.incoming_vests / outgoing_vests |
raw ×1,000,000 | VESTS. *_hp columns unchanged |
accounts.to_withdraw |
remaining amount, dropped after each payout | total power-down amount (as in hived) |
accounts.vesting_withdraw_rate |
to_withdraw / 13 | rounded up, as hived does since HF21 |
accounts.next_vesting_withdrawal |
drifted 3s per weekly payout | exact. NULL when no power down is active |
rc_delegations.rc |
text |
numeric |
rc_delegations.timestamp |
last sync time of the row | block time of the delegation op |
comments.net_rshares |
sum of absolute rshares | signed sum (downvotes subtract) |
comments.abs_rshares |
n/a | new column: sum of absolute rshares |
comments.total_rshares / net_rshares |
changed votes counted twice | only each voter's latest vote counts |
operation_account_update*_table.json_metadata / posting_json_metadata |
{} when the op left it empty |
NULL (empty means "unchanged" on chain) |
Behavior changes
- Comments deleted and then re-posted at the same permlink are now a new row with a new
id, the same as hivemind. Before, they stayed marked as deleted. - Weekly market buckets now run Monday to Sunday. Before, Sunday trades landed in the next week. Existing buckets are rebuilt.
hafsql.get_timestamp,hafsql.id_from_timestampandcomments.cashout_time/last_payoutnow give correct results when your session timezone isn't UTC.hafsql.get_timestampnow also accepts a block number (int4).hafd.operation_id_to_type_idwas removed from the docs.
Fixes (no query changes needed)
- Reblog permlinks were wrong.
- Account metadata was wiped by updates with empty metadata.
- Comment titles were blanked by edits with an empty title.
get_balance(account, block)andbalances_historywere slow.


