-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #691 from Giveth/hotfix_1661_delete_gnosis_recipie…
…nts_of_givingblocks_projects Hotfix 1661 delete gnosis recipients of givingblocks projects
- Loading branch information
Showing
1 changed file
with
28 additions
and
0 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
migration/1666068280230-deleteGnosisRecipientsOfGivingblocksProjects.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,28 @@ | ||
import { MigrationInterface, QueryRunner } from 'typeorm'; | ||
|
||
export class deleteGnosisRecipientsOfGivingblocksProjects1666068280230 | ||
implements MigrationInterface | ||
{ | ||
async up(queryRunner: QueryRunner): Promise<void> { | ||
const projectTableExists = await queryRunner.hasTable('project'); | ||
const projectAddressTableExists = await queryRunner.hasTable( | ||
'project_address', | ||
); | ||
if (!projectTableExists || !projectAddressTableExists) { | ||
// tslint:disable-next-line:no-console | ||
console.log('The project table or project_Address table doesnt exist', { | ||
projectAddressTableExists, | ||
projectTableExists, | ||
}); | ||
return; | ||
} | ||
|
||
await queryRunner.query(` | ||
DELETE FROM project_address | ||
USING project | ||
WHERE project_address."projectId" = project.id AND project_address."networkId"=100 AND project."givingBlocksId" IS NOT NULL | ||
`); | ||
} | ||
|
||
async down(queryRunner: QueryRunner): Promise<void> {} | ||
} |