-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: add relations between study participant and game player(s)
this is a more reliable way to keep track of the games that a participant played, using the User relation involves some guesswork
- Loading branch information
Showing
5 changed files
with
111 additions
and
2 deletions.
There are no files selected for viewing
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
24 changes: 24 additions & 0 deletions
24
server/src/migration/1727891252710-AddProlificParticipantPlayer.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,24 @@ | ||
import { MigrationInterface, QueryRunner } from "typeorm"; | ||
|
||
export class AddProlificParticipantPlayer1727891252710 implements MigrationInterface { | ||
name = 'AddProlificParticipantPlayer1727891252710' | ||
|
||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(`ALTER TABLE "prolific_study_participant" ADD "prolificBaselinePlayerId" integer`); | ||
await queryRunner.query(`ALTER TABLE "prolific_study_participant" ADD CONSTRAINT "UQ_da2b1f49f29eef7941ab06eca11" UNIQUE ("prolificBaselinePlayerId")`); | ||
await queryRunner.query(`ALTER TABLE "prolific_study_participant" ADD "prolificVariablePlayerId" integer`); | ||
await queryRunner.query(`ALTER TABLE "prolific_study_participant" ADD CONSTRAINT "UQ_b5a15c60ff91e4b754305c64137" UNIQUE ("prolificVariablePlayerId")`); | ||
await queryRunner.query(`ALTER TABLE "prolific_study_participant" ADD CONSTRAINT "FK_da2b1f49f29eef7941ab06eca11" FOREIGN KEY ("prolificBaselinePlayerId") REFERENCES "solo_player"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`); | ||
await queryRunner.query(`ALTER TABLE "prolific_study_participant" ADD CONSTRAINT "FK_b5a15c60ff91e4b754305c64137" FOREIGN KEY ("prolificVariablePlayerId") REFERENCES "solo_player"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`); | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(`ALTER TABLE "prolific_study_participant" DROP CONSTRAINT "FK_b5a15c60ff91e4b754305c64137"`); | ||
await queryRunner.query(`ALTER TABLE "prolific_study_participant" DROP CONSTRAINT "FK_da2b1f49f29eef7941ab06eca11"`); | ||
await queryRunner.query(`ALTER TABLE "prolific_study_participant" DROP CONSTRAINT "UQ_b5a15c60ff91e4b754305c64137"`); | ||
await queryRunner.query(`ALTER TABLE "prolific_study_participant" DROP COLUMN "prolificVariablePlayerId"`); | ||
await queryRunner.query(`ALTER TABLE "prolific_study_participant" DROP CONSTRAINT "UQ_da2b1f49f29eef7941ab06eca11"`); | ||
await queryRunner.query(`ALTER TABLE "prolific_study_participant" DROP COLUMN "prolificBaselinePlayerId"`); | ||
} | ||
|
||
} |
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
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
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