-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add streamed mini donations to qf round
related to Giveth/giveth-dapps-v2#3284
- Loading branch information
1 parent
61f196c
commit 5b25537
Showing
2 changed files
with
36 additions
and
11 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
migration/1715521134568-relate_current_mini_stream_donations_to_qf_Rounds.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,25 @@ | ||
import { MigrationInterface, QueryRunner } from 'typeorm'; | ||
|
||
export class RelateCurrentMiniStreamDonationsToQfRounds1715521134568 | ||
implements MigrationInterface | ||
{ | ||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(` | ||
UPDATE donation | ||
SET "qfRoundId" = qf_round.id | ||
FROM project_qf_rounds_qf_round, qf_round | ||
WHERE donation."recurringDonationId" IS NOT NULL | ||
AND donation."projectId" = project_qf_rounds_qf_round."projectId" | ||
AND project_qf_rounds_qf_round."qfRoundId" = qf_round."id" | ||
AND donation."createdAt" BETWEEN qf_round."beginDate" AND qf_round."endDate" | ||
`); | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
// Since the `up` migration changes data based on existing conditions rather than schema, | ||
// rolling back would ideally require prior knowledge of the previous state, which might | ||
// not be practical or possible to restore. | ||
// Therefore, typically for data migrations, the down method might be left empty or | ||
// could reset changes based on specific requirements. | ||
} | ||
} |
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