def build_blocks_table(ex, should_drop=True): blocks = t.Table('blocks', t.AutoIncrementColumn('number'), [t.Column('hash', t.str_len(64), True)] + [ t.Column(field_name, field_type) for field_name, field_type in BLOCK_DATA_COLS.items() ]) return create_table(ex, blocks, should_drop)
def build_transactions_table(ex, should_drop=True): transactions = t.Table( 'transactions', t.Column('hash', t.str_len(64), True), [ t.Column('data', str), t.Column('block_hash', t.str_len(64)), # TODO how to index this column? ]) return create_table(ex, transactions, should_drop)
def build_contracts_table(ex, should_drop=True): contracts = t.Table('smart_contracts', t.Column('contract_id', t.str_len(64), True), [ t.Column('code_str', str), t.Column('author', t.str_len(64)), t.Column('execution_datetime', datetime.datetime), t.Column('execution_status', t.str_len(30)), ]) return create_table(ex, contracts, should_drop)