This repository has been archived by the owner on Mar 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add timestamp to indexed events (#42)
Currently, the indexer does not store the timestamp associated with blockchain events. As part of [ACT-612](https://linear.app/valora/issue/ACT-612/add-time-field-to-valora-transfer-events), this PR adds this functionality and updates the database schema as required.
- Loading branch information
1 parent
df46ff5
commit dab32b3
Showing
3 changed files
with
71 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { Knex } from 'knex' | ||
|
||
const TABLE_NAMES = [ | ||
'account_wallet_mappings', | ||
'attestations_completed', | ||
'escrow', | ||
'transfers', | ||
] | ||
|
||
export async function up(knex: Knex): Promise<void> { | ||
await Promise.all( | ||
TABLE_NAMES.map( | ||
async (tableName) => | ||
await knex.schema.alterTable(tableName, (table) => | ||
table.bigInteger('blockTimestamp'), | ||
), | ||
), | ||
) | ||
} | ||
|
||
export async function down(knex: Knex): Promise<void> { | ||
await Promise.all( | ||
TABLE_NAMES.map( | ||
async (tableName) => | ||
await knex.schema.alterTable(tableName, (table) => | ||
table.dropColumn('blockTimestamp'), | ||
), | ||
), | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters