From 0735d3bff7eb72c511c7f3da2edd1ea47ceaccf2 Mon Sep 17 00:00:00 2001 From: Thanh Hao Date: Fri, 17 Mar 2023 14:47:23 +0700 Subject: [PATCH] migration data when App is init --- ...09504296-add-unique-token-markets-table.ts | 6 +++++ ...1246-migrate-data-contract-verification.ts | 18 ------------- ...ate-data-from-contract-to-contract-code.ts | 25 ------------------- 3 files changed, 6 insertions(+), 43 deletions(-) delete mode 100644 src/migrations/1677556651246-migrate-data-contract-verification.ts delete mode 100644 src/migrations/1677556651246-migrate-data-from-contract-to-contract-code.ts diff --git a/src/migrations/1670809504296-add-unique-token-markets-table.ts b/src/migrations/1670809504296-add-unique-token-markets-table.ts index 956ec010..8a5dcd67 100644 --- a/src/migrations/1670809504296-add-unique-token-markets-table.ts +++ b/src/migrations/1670809504296-add-unique-token-markets-table.ts @@ -9,6 +9,12 @@ export class addUniqueTokenMarketsTable1670809504296 await queryRunner.query( `ALTER TABLE \`token_markets\` ADD UNIQUE INDEX \`IDX_94264568c451f4f826938950ee\` (\`contract_address\`)`, ); + await queryRunner.query( + `INSERT INTO \`token_markets\` (\`contract_address\`, \`coin_id\`, \`symbol\` , \`name\`, \`code_id\`, \`image\`) VALUES('0x5b0dfe077b16479715c9838eb644892008abbfe6', 'bitcoin', 'btc', 'Bitcoin', 0, 'https://assets.coingecko.com/coins/images/1/large/bitcoin.png?1547033579')`, + ); + await queryRunner.query( + `INSERT INTO \`token_markets\` (\`contract_address\`, \`coin_id\`, \`symbol\` , \`name\`, \`code_id\`, \`image\`) VALUES('0x23c5d1164662758b3799103effe19cc064d897d6', 'aura-network', 'aura', 'Aura Network', 0, 'https://assets.coingecko.com/coins/images/25768/large/LOGO-AURA-WHITE.png?1653604372')`, + ); } public async down(queryRunner: QueryRunner): Promise { diff --git a/src/migrations/1677556651246-migrate-data-contract-verification.ts b/src/migrations/1677556651246-migrate-data-contract-verification.ts deleted file mode 100644 index 9cf60548..00000000 --- a/src/migrations/1677556651246-migrate-data-contract-verification.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; - -export class migrateDataContractVerification1677556651246 - implements MigrationInterface -{ - name = 'migrateDataContractVerification1677556651246'; - - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `UPDATE \`smart_contract_codes\` AS \`scc\` - SET \`scc\`.\`contract_verification\` = 'VERIFIED' - WHERE \`scc\`.\`contract_verification\` IN ('EXACT MATCH', 'SIMILAR MATCH'); - `, - ); - } - - public async down(queryRunner: QueryRunner): Promise {} -} diff --git a/src/migrations/1677556651246-migrate-data-from-contract-to-contract-code.ts b/src/migrations/1677556651246-migrate-data-from-contract-to-contract-code.ts deleted file mode 100644 index 553c47f4..00000000 --- a/src/migrations/1677556651246-migrate-data-from-contract-to-contract-code.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; - -export class migrateDataFromContractToContractCode1677556651246 - implements MigrationInterface -{ - name = 'migrateDataFromContractToContractCode1677556651246'; - - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `UPDATE \`smart_contract_codes\` AS \`scc\` - INNER JOIN \`smart_contracts\` AS \`sc\` ON \`scc\`.\`code_id\` = \`sc\`.\`code_id\` - SET \`scc\`.\`contract_verification\` = \`sc\`.\`contract_verification\` - , \`scc\`.\`url\` = \`sc\`.\`url\` - , \`scc\`.\`verified_at\` = \`sc\`.\`verified_at\` - , \`scc\`.\`instantiate_msg_schema\` = \`sc\`.\`instantiate_msg_schema\` - , \`scc\`.\`query_msg_schema\` = \`sc\`.\`query_msg_schema\` - , \`scc\`.\`execute_msg_schema\` = \`sc\`.\`execute_msg_schema\` - , \`scc\`.\`contract_hash\` = \`sc\`.\`contract_hash\` - , \`scc\`.\`s3_location\` = \`sc\`.\`s3_location\` - `, - ); - } - - public async down(queryRunner: QueryRunner): Promise {} -}