Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated project_instant_power_view create script #1069

Merged
merged 1 commit into from
Jul 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { MigrationInterface, QueryRunner } from 'typeorm';

export class CreateProjectInstantPowerView1683191367803
export class CreateProjectInstantPowerView1683191367804
implements MigrationInterface
{
async up(queryRunner: QueryRunner): Promise<void> {
Expand All @@ -27,15 +27,13 @@ export class CreateProjectInstantPowerView1683191367803
LEFT JOIN (
SELECT
"powerBoosting"."projectId",
"powerBoosting"."userId",
sum("instantPowerBalance".balance * "powerBoosting".percentage :: double precision / 100 :: double precision) AS "boostedPower",
now() AS "updateTime"
FROM
instant_power_balance "instantPowerBalance"
JOIN power_boosting "powerBoosting" ON "powerBoosting"."userId" = "instantPowerBalance"."userId"
GROUP BY
"powerBoosting"."projectId",
"powerBoosting"."userId"
"powerBoosting"."projectId"
) pp ON pp."projectId" = project.id
GROUP BY
project.id
Expand Down
8 changes: 4 additions & 4 deletions test/pre-test-scripts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import { createGivPowerHistoricTablesProcedure1670429143091 } from '../migration
import { LastSnapshotProjectPowerView1671448387986 } from '../migration/1671448387986-LastSnapshotProjectPowerView';
import { AppDataSource } from '../src/orm';
import { createOrganisatioTokenTable1646302349926 } from '../migration/1646302349926-createOrganisatioTokenTable';
import { CreateProjectInstantPowerView1683191367803 } from '../migration/1683191367803-CreateProjectInstantPowerView';
import { CreateProjectInstantPowerView1683191367804 } from '../migration/1683191367804-CreateProjectInstantPowerView';
import { ProjectDonationSummaryView1685972291645 } from '../migration/1685972291645-ProjectDonationSummaryView';
import { ProjectEstimatedMatchingView1685958638251 } from '../migration/1685958638251-ProjectEstimatedMatchingView';
import { CreateProjectUserInstantPowerView1689504711172 } from '../migration/1689504711172-CreateProjectUserInstantPowerView';
Expand Down Expand Up @@ -364,8 +364,8 @@ async function runMigrations() {
new TakePowerBoostingSnapshotProcedure1663594895751();
const takeSnapshotsHistoryProcedure =
new createGivPowerHistoricTablesProcedure1670429143091();
const createProjectInstantPowerView1683191367803 =
new CreateProjectInstantPowerView1683191367803();
const createProjectInstantPowerView1683191367804 =
new CreateProjectInstantPowerView1683191367804();

const projectDonationSummaryView =
new ProjectDonationSummaryView1685972291645();
Expand All @@ -381,7 +381,7 @@ async function runMigrations() {
await takeSnapshotProcedure.up(queryRunner);
await takeSnapshotsHistoryProcedure.up(queryRunner);
await new createOrganisatioTokenTable1646302349926().up(queryRunner);
await createProjectInstantPowerView1683191367803.up(queryRunner);
await createProjectInstantPowerView1683191367804.up(queryRunner);
await projectDonationSummaryView.up(queryRunner);
await projectEstimatedMatchingView.up(queryRunner);
await createProjectUserInstantPowerView1689504711172.up(queryRunner);
Expand Down