Skip to content

Commit

Permalink
chore: squash prolific study migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
sgfost committed Oct 18, 2024
1 parent 2d7709f commit e7e3512
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 27 deletions.
24 changes: 0 additions & 24 deletions server/src/migration/1727891252710-AddProlificParticipantPlayer.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { MigrationInterface, QueryRunner } from "typeorm";

export class AddProlificSologameStudy1726604412870 implements MigrationInterface {
name = 'AddProlificSologameStudy1726604412870'
export class AddProlificStudySologameSetup1729281440232 implements MigrationInterface {
name = 'AddProlificStudySologameSetup1729281440232'

public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`CREATE TABLE "prolific_study_participant" ("id" SERIAL NOT NULL, "userId" integer NOT NULL, "prolificId" character varying NOT NULL, "studyId" integer NOT NULL, "prolificBaselineTreatmentId" integer NOT NULL, "prolificVariableTreatmentId" integer NOT NULL, CONSTRAINT "REL_2a288d9abbe25b1817c68c37d7" UNIQUE ("userId"), CONSTRAINT "PK_30d57ab554a381a7d364a257513" PRIMARY KEY ("id"))`);
await queryRunner.query(`CREATE TABLE "prolific_study_participant" ("id" SERIAL NOT NULL, "userId" integer NOT NULL, "prolificId" character varying NOT NULL, "studyId" integer NOT NULL, "prolificBaselineTreatmentId" integer NOT NULL, "prolificVariableTreatmentId" integer NOT NULL, "prolificBaselinePlayerId" integer, "prolificVariablePlayerId" integer, CONSTRAINT "REL_2a288d9abbe25b1817c68c37d7" UNIQUE ("userId"), CONSTRAINT "REL_da2b1f49f29eef7941ab06eca1" UNIQUE ("prolificBaselinePlayerId"), CONSTRAINT "REL_b5a15c60ff91e4b754305c6413" UNIQUE ("prolificVariablePlayerId"), CONSTRAINT "PK_30d57ab554a381a7d364a257513" PRIMARY KEY ("id"))`);
await queryRunner.query(`CREATE TABLE "prolific_study" ("id" SERIAL NOT NULL, "isActive" boolean NOT NULL DEFAULT true, "description" character varying, "externalSurveyUrl" character varying, "studyId" character varying NOT NULL, "completionCode" character varying NOT NULL, CONSTRAINT "PK_3fcda1de03b25111b6584b63422" PRIMARY KEY ("id"))`);
await queryRunner.query(`ALTER TABLE "solo_game_treatment" ADD "gameType" character varying NOT NULL DEFAULT 'freeplay'`);
await queryRunner.query(`ALTER TABLE "solo_game_treatment" ADD "isLowResSystemHealth" boolean NOT NULL DEFAULT false`);
Expand All @@ -20,17 +20,29 @@ export class AddProlificSologameStudy1726604412870 implements MigrationInterface
await queryRunner.query(`ALTER TABLE "solo_mars_event_card" ALTER COLUMN "systemHealthMultiplier" SET DEFAULT '0'`);
await queryRunner.query(`ALTER TABLE "solo_mars_event_card" ALTER COLUMN "pointsMultiplier" SET DEFAULT '0'`);
await queryRunner.query(`ALTER TABLE "solo_mars_event_card" ALTER COLUMN "resourcesMultiplier" SET DEFAULT '0'`);
await queryRunner.query(`ALTER TABLE "solo_player" ADD CONSTRAINT "UQ_68410b02beb97d426ee11e523ec" UNIQUE ("gameId")`);
await queryRunner.query(`ALTER TABLE "solo_high_score" ADD CONSTRAINT "UQ_8d7898d5fad7b94e42b86cb7d92" UNIQUE ("gameId")`);
await queryRunner.query(`ALTER TABLE "solo_player" ADD CONSTRAINT "FK_68410b02beb97d426ee11e523ec" FOREIGN KEY ("gameId") REFERENCES "solo_game"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE "prolific_study_participant" ADD CONSTRAINT "FK_2a288d9abbe25b1817c68c37d74" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE "prolific_study_participant" ADD CONSTRAINT "FK_c75960626fca5f5a1c3508ff98f" FOREIGN KEY ("studyId") REFERENCES "prolific_study"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE "prolific_study_participant" ADD CONSTRAINT "FK_18b94ad2f7f5b4d7ead5e865864" FOREIGN KEY ("prolificBaselineTreatmentId") REFERENCES "solo_game_treatment"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE "prolific_study_participant" ADD CONSTRAINT "FK_9fe3e4ae5dc5a2ae09e7a4f4bcc" FOREIGN KEY ("prolificVariableTreatmentId") REFERENCES "solo_game_treatment"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`);
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`);
await queryRunner.query(`ALTER TABLE "solo_high_score" ADD CONSTRAINT "FK_8d7898d5fad7b94e42b86cb7d92" FOREIGN KEY ("gameId") REFERENCES "solo_game"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`);
}

public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "solo_high_score" DROP CONSTRAINT "FK_8d7898d5fad7b94e42b86cb7d92"`);
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 "FK_9fe3e4ae5dc5a2ae09e7a4f4bcc"`);
await queryRunner.query(`ALTER TABLE "prolific_study_participant" DROP CONSTRAINT "FK_18b94ad2f7f5b4d7ead5e865864"`);
await queryRunner.query(`ALTER TABLE "prolific_study_participant" DROP CONSTRAINT "FK_c75960626fca5f5a1c3508ff98f"`);
await queryRunner.query(`ALTER TABLE "prolific_study_participant" DROP CONSTRAINT "FK_2a288d9abbe25b1817c68c37d74"`);
await queryRunner.query(`ALTER TABLE "solo_player" DROP CONSTRAINT "FK_68410b02beb97d426ee11e523ec"`);
await queryRunner.query(`ALTER TABLE "solo_high_score" DROP CONSTRAINT "UQ_8d7898d5fad7b94e42b86cb7d92"`);
await queryRunner.query(`ALTER TABLE "solo_player" DROP CONSTRAINT "UQ_68410b02beb97d426ee11e523ec"`);
await queryRunner.query(`ALTER TABLE "solo_mars_event_card" ALTER COLUMN "resourcesMultiplier" DROP DEFAULT`);
await queryRunner.query(`ALTER TABLE "solo_mars_event_card" ALTER COLUMN "pointsMultiplier" DROP DEFAULT`);
await queryRunner.query(`ALTER TABLE "solo_mars_event_card" ALTER COLUMN "systemHealthMultiplier" DROP DEFAULT`);
Expand Down

0 comments on commit e7e3512

Please sign in to comment.