Skip to content

Commit

Permalink
create pseudo tables (#140)
Browse files Browse the repository at this point in the history
  • Loading branch information
0xyijing committed Dec 18, 2023
1 parent be1de3f commit 668bd50
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions migrations/celo/1698709703000-CreateWrapUnwrapNativeEventsTable.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import { MigrationInterface, QueryRunner, Table } from 'typeorm';

// Create pseudo table in Celo for api.intrinsic_enriched_transactions pipeline
const wrapNativeEvent = new Table({
name: 'events_celo.wrap_native_events',
columns: [
{ name: 'observed_timestamp', type: 'bigint' },
{ name: 'contract_address', type: 'varchar' },
{ name: 'transaction_hash', type: 'varchar', isPrimary: true },
{ name: 'transaction_index', type: 'bigint' },
{ name: 'log_index', type: 'bigint', isPrimary: true },
{ name: 'block_hash', type: 'varchar' },
{ name: 'block_number', type: 'bigint' },
{ name: 'dst', type: 'varchar' },
{ name: 'wad', type: 'numeric' },
],
});

const unwrapNativeEvent = new Table({
name: 'events_celo.unwrap_native_events',
columns: [
{ name: 'observed_timestamp', type: 'bigint' },
{ name: 'contract_address', type: 'varchar' },
{ name: 'transaction_hash', type: 'varchar', isPrimary: true },
{ name: 'transaction_index', type: 'bigint' },
{ name: 'log_index', type: 'bigint', isPrimary: true },
{ name: 'block_hash', type: 'varchar' },
{ name: 'block_number', type: 'bigint' },
{ name: 'src', type: 'varchar' },
{ name: 'wad', type: 'numeric' },
],
});

export class CreateWrapUnwrapNativeEventsTable1698709703000 implements MigrationInterface {
public async up(queryRunner: QueryRunner): Promise<any> {
await queryRunner.createTable(wrapNativeEvent);
await queryRunner.createTable(unwrapNativeEvent);
}

public async down(queryRunner: QueryRunner): Promise<any> {
await queryRunner.dropTable(wrapNativeEvent);
await queryRunner.dropTable(unwrapNativeEvent);
}
}

0 comments on commit 668bd50

Please sign in to comment.