-
Notifications
You must be signed in to change notification settings - Fork 135
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
indexer-agent: Add new column to invalid_receipts table
- Loading branch information
Showing
2 changed files
with
41 additions
and
0 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
packages/indexer-agent/src/db/migrations/16-modify-invalid-receipts-table.ts
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,34 @@ | ||
import { Logger } from '@graphprotocol/common-ts' | ||
import { QueryInterface, DataTypes } from 'sequelize' | ||
|
||
interface MigrationContext { | ||
queryInterface: QueryInterface | ||
logger: Logger | ||
} | ||
|
||
interface Context { | ||
context: MigrationContext | ||
} | ||
|
||
export async function up({ context }: Context): Promise<void> { | ||
const { queryInterface, logger } = context | ||
|
||
const tables = await queryInterface.showAllTables() | ||
logger.debug( | ||
`Modifying tables scalar_tap_receipts_invalid to add extra column`, | ||
) | ||
|
||
if (tables.includes('scalar_tap_receipts_invalid')) { | ||
await queryInterface.addColumn('scalar_tap_receipts_invalid', 'error_log', { | ||
type: DataTypes.TEXT, | ||
allowNull: false, | ||
defaultValue: '', | ||
}) | ||
} | ||
} | ||
|
||
export async function down({ context }: Context): Promise<void> { | ||
const { queryInterface, logger } = context | ||
logger.info(`Drop function, trigger, indices, and table`) | ||
queryInterface.removeColumn('scalar_tap_receipts_invalid', 'error_log') | ||
} |
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