Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

create pseudo tables #140

Merged
merged 1 commit into from
Dec 18, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
}
}
Loading