Event DB crate

The event-db crate abstracts all database operations.

This will allow us to iterate the backend data storage without requiring large changes to the consuming services.

Overview Diagram



erd

Catalyst Event Database Overview


ballot


ballot

Column

Type


row_id


bigint+

objective

integer

proposal

integer

voter

integer

fragment_id

text

cast_at

timestamp

choice

smallint

raw_fragment

bytea



objective


objective

Column

Type


row_id


integer+

id

integer

event

integer

category

text

title

text

description

text

deleted

boolean

rewards_currency

text

rewards_total

bigint

rewards_total_lovelace

bigint

proposers_rewards

bigint

vote_options

integer

extra

jsonb



ballot:objective_out->objective:row_id





proposal


proposal

Column

Type


row_id


integer+

id

integer

objective

integer

title

text

summary

text

category

text

public_key

text

funds

bigint

url

text

files_url

text

impact_score

bigint

deleted

boolean

extra

jsonb

proposer_name

text

proposer_contact

text

proposer_url

text

proposer_relevant_experience

text

bb_proposal_id

bytea

bb_vote_options

ARRAY



ballot:proposal_out->proposal:row_id





voter


voter

Column

Type


row_id


bigint+

voting_key

text

snapshot_id

integer

voting_group

text

voting_power

bigint



ballot:voter_out->voter:row_id





committee_member


committee_member

Column

Type


row_id


integer+

committee

integer

member_index

integer

threshold

integer

comm_pk

text

comm_sk

text

member_pk

text

member_sk

text



tally_committee


tally_committee

Column

Type


row_id


integer+

event

integer

committee_pk

text

committee_id

text

member_crs

text

election_key

text



committee_member:committee_out->tally_committee:row_id





config


config

Column

Type


row_id


integer+

id

varchar

id2

varchar

id3

varchar

value

jsonb



contribution


contribution

Column

Type


row_id


bigint+

stake_public_key

text

snapshot_id

integer

voting_key

text

voting_weight

integer

voting_key_idx

integer

value

bigint

voting_group

text

reward_address

text



snapshot


snapshot

Column

Type


row_id


integer+

event

integer

as_at

timestamp

as_at_slotno

integer

last_updated

timestamp

last_updated_slotno

integer

final

boolean

dbsync_snapshot_cmd

text

dbsync_snapshot_params

jsonb

dbsync_snapshot_data

bytea

dbsync_snapshot_error

bytea

dbsync_snapshot_unregistered

bytea

drep_data

bytea

catalyst_snapshot_cmd

text

catalyst_snapshot_params

jsonb

catalyst_snapshot_data

bytea



contribution:snapshot_id_out->snapshot:row_id





currency


currency

Column

Type


name


text

description

text



event


event

Column

Type


row_id


integer+

name

text

description

text

registration_snapshot_time

timestamp

snapshot_start

timestamp

voting_power_threshold

bigint

max_voting_power_pct

numeric

review_rewards

bigint

start_time

timestamp

end_time

timestamp

insight_sharing_start

timestamp

proposal_submission_start

timestamp

refine_proposals_start

timestamp

finalize_proposals_start

timestamp

proposal_assessment_start

timestamp

assessment_qa_start

timestamp

voting_start

timestamp

voting_end

timestamp

tallying_end

timestamp

block0

bytea

block0_hash

text

committee_size

integer

committee_threshold

integer

extra

jsonb

cast_to

jsonb



goal


goal

Column

Type


id


integer+

event_id

integer

idx

integer

name

varchar



goal:event_id_out->event:row_id





moderation


moderation

Column

Type


row_id


integer+

review_id

integer

user_id

integer

classification

integer

rationale

varchar



moderation:user_id_out->config:row_id





proposal_review


proposal_review

Column

Type


row_id


integer+

proposal_id

integer

assessor

varchar

assessor_level

integer

reward_address

text

impact_alignment_rating_given

integer

impact_alignment_note

varchar

feasibility_rating_given

integer

feasibility_note

varchar

auditability_rating_given

integer

auditability_note

varchar

ranking

integer

flags

jsonb



moderation:review_id_out->proposal_review:row_id





moderation_allocation


moderation_allocation

Column

Type


row_id


integer+

review_id

integer

user_id

integer



moderation_allocation:user_id_out->config:row_id





moderation_allocation:review_id_out->proposal_review:row_id





objective:rewards_currency_out->currency:name





objective:event_out->event:row_id





objective_category


objective_category

Column

Type


name


text

description

text



objective:category_out->objective_category:name





vote_options


vote_options

Column

Type


id


integer+

idea_scale

ARRAY

objective

ARRAY



objective:vote_options_out->vote_options:id





objective_review_metric


objective_review_metric

Column

Type


row_id


integer+

objective

integer

metric

integer

note

boolean

review_group

varchar



objective_review_metric:objective_out->objective:row_id





review_metric


review_metric

Column

Type


row_id


integer+

name

varchar

description

varchar

min

integer

max

integer

map

ARRAY



objective_review_metric:metric_out->review_metric:row_id





proposal:objective_out->objective:row_id





proposal:bb_vote_options_out->vote_options:objective





proposal_review:proposal_id_out->proposal:row_id





reviewer_level


reviewer_level

Column

Type


row_id


integer+

name

text

total_reward_pct

numeric

event_id

integer



proposal_review:assessor_level_out->reviewer_level:row_id





proposal_voteplan


proposal_voteplan

Column

Type


row_id


integer+

proposal_id

integer

voteplan_id

integer

bb_proposal_index

bigint



proposal_voteplan:proposal_id_out->proposal:row_id





voteplan


voteplan

Column

Type


row_id


integer+

objective_id

integer

id

varchar

category

text

encryption_key

varchar

group_id

text

token_id

text



proposal_voteplan:voteplan_id_out->voteplan:row_id





review_rating


review_rating

Column

Type


row_id


integer+

review_id

integer

metric

integer

rating

integer

note

varchar



review_rating:review_id_out->proposal_review:row_id





review_rating:metric_out->review_metric:row_id





reviewer_level:event_id_out->event:row_id





snapshot:event_out->event:row_id





tally_committee:event_out->event:row_id





voteplan:objective_id_out->objective:row_id





voteplan_category


voteplan_category

Column

Type


name


text

public_key

boolean



voteplan:category_out->voteplan_category:name





voting_group


voting_group

Column

Type


name


text



voteplan:group_id_out->voting_group:name





voter:snapshot_id_out->snapshot:row_id





voting_node


voting_node

Column

Type


hostname


text


event


integer

pubkey

text

seckey

text

netkey

text



voting_node:event_out->event:row_id





LEGEND


LEGEND

Type

Example


Primary Key


integer+

Standard Field

bytea

Nullable Field

text

Sized Field

varchar(32)

Autoincrement Field

integer+