Skip to content

Commit 0f8e557

Browse files
Merge pull request #762 from bcgov/feat/srs-12
removing the constraints to support data migration
2 parents 0f5e26f + 5f393cc commit 0f8e557

File tree

4 files changed

+41
-8
lines changed

4 files changed

+41
-8
lines changed

backend/users/src/app/entities/appParticipant.entity.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,6 @@ import { ParticipantRole } from './participantRole.entity';
1212
import { Person } from './person.entity';
1313

1414
@Index('idx_app_participant_application_id', ['applicationId'], {})
15-
@Index(
16-
'uidx_application_id_participant_role_id',
17-
['applicationId', 'participantRoleId'],
18-
{ unique: true },
19-
)
2015
@Index('pk_app_participant', ['id'], { unique: true })
2116
@Index('idx_app_participant_organization_id', ['organizationId'], {})
2217
@Index('idx_app_participant_participant_role_id', ['participantRoleId'], {})

backend/users/src/app/entities/appStatus.entity.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@ import { Application } from './application.entity';
1111
import { StatusType } from './statusType.entity';
1212

1313
@Index('idx_app_status_application_id', ['applicationId'], {})
14-
@Index('uidx_app_status_is_current_application_id', ['applicationId'], {
15-
unique: true,
16-
})
1714
@Index('pk_app_status', ['id'], { unique: true })
1815
@Index('idx_app_status_status_type_id', ['statusTypeId'], {})
1916
@Entity('app_status')
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import { MigrationInterface, QueryRunner } from 'typeorm';
2+
3+
export class masterScript1739939250557 implements MigrationInterface {
4+
name = 'masterScript1739939250557';
5+
6+
public async up(queryRunner: QueryRunner): Promise<void> {
7+
await queryRunner.query(
8+
`DROP INDEX "cats"."uidx_app_status_is_current_application_id"`,
9+
);
10+
11+
await queryRunner.query(`
12+
ALTER TABLE "cats"."app_status"
13+
DROP CONSTRAINT "REL_33e54882e3e4e9145299f480de";
14+
`);
15+
}
16+
17+
public async down(queryRunner: QueryRunner): Promise<void> {
18+
await queryRunner.query(`
19+
ALTER TABLE "cats"."app_status"
20+
ADD CONSTRAINT "REL_33e54882e3e4e9145299f480de" UNIQUE ("application_id");
21+
`);
22+
23+
await queryRunner.query(
24+
`CREATE UNIQUE INDEX "uidx_app_status_is_current_application_id" ON "cats"."app_status" ("application_id") `,
25+
);
26+
}
27+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { MigrationInterface, QueryRunner } from "typeorm";
2+
3+
export class masterScript1739939672512 implements MigrationInterface {
4+
name = 'masterScript1739939672512'
5+
6+
public async up(queryRunner: QueryRunner): Promise<void> {
7+
await queryRunner.query(`DROP INDEX "cats"."uidx_application_id_participant_role_id"`);
8+
}
9+
10+
public async down(queryRunner: QueryRunner): Promise<void> {
11+
await queryRunner.query(`CREATE UNIQUE INDEX "uidx_application_id_participant_role_id" ON "cats"."app_participant" ("application_id", "participant_role_id") `);
12+
}
13+
14+
}

0 commit comments

Comments
 (0)