event-scraper-v3/src/migration/1627606235070-CreateEvent.ts

165 lines
3.3 KiB
TypeScript

import { MigrationInterface, QueryRunner, Table } from 'typeorm';
export class CreateEvent1627606235070 implements MigrationInterface {
async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.createTable(
new Table({
name: 'event',
columns: [
{
name: 'fill',
type: 'bool',
},
{
name: 'out',
type: 'bool',
},
{
name: 'bid',
type: 'bool',
},
{
name: 'maker',
type: 'bool',
},
{
name: 'address',
type: 'text',
},
{
name: 'programId',
type: 'text',
},
{
name: 'baseCurrency',
type: 'text',
},
{
name: 'quoteCurrency',
type: 'text',
},
{
name: 'openOrderSlot',
type: 'text',
},
{
name: 'feeTier',
type: 'text',
},
{
name: 'nativeQuantityReleased',
type: 'text',
},
{
name: 'nativeQuantityPaid',
type: 'text',
},
{
name: 'nativeFeeOrRebate',
type: 'text',
},
{
name: 'orderId',
type: 'text',
},
{
name: 'openOrders',
type: 'text',
},
{
name: 'clientOrderId',
type: 'text',
},
{
name: 'uuid',
type: 'text',
},
{
name: 'source',
type: 'text',
},
{
name: 'seqNum',
type: 'int8',
},
{
name: 'loadTimestamp',
type: 'timestamptz',
},
],
}),
true
);
await queryRunner.createTable(
new Table({
name: 'currency_meta',
columns: [
{
name: 'address',
type: 'text',
},
{
name: 'programId',
type: 'text',
},
{
name: 'currency',
type: 'text',
},
{
name: 'MintDecimals',
type: 'int4',
},
],
}),
true
);
await queryRunner.createTable(
new Table({
name: 'owner',
columns: [
{
name: 'openOrders',
type: 'text',
},
{
name: 'owner',
type: 'text',
},
],
}),
true
);
await queryRunner.createTable(
new Table({
name: 'sequence_number',
columns: [
{
name: 'address',
type: 'text',
},
{
name: 'loadTimestamp',
type: 'timestamptz',
},
{
name: 'seqNum',
type: 'int8',
},
],
}),
true
);
}
async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.dropTable('event');
await queryRunner.dropTable('currency_meta');
await queryRunner.dropTable('sequence_number');
await queryRunner.dropTable('owner');
}
}