Skip to content

Commit

Permalink
fix: rework fix to include missing table in existing migration
Browse files Browse the repository at this point in the history
  • Loading branch information
jcmelati committed Apr 10, 2024
1 parent afd441c commit 0862dbd
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 90 deletions.

This file was deleted.

3 changes: 1 addition & 2 deletions packages/data-store/src/migrations/generic/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { CreateStatusList1693866470000 } from './4-CreateStatusList'
import { CreateAuditEvents1701635835330 } from './5-CreateAuditEvents'
import { CreateDigitalCredential1708525189000 } from './6-CreateDigitalCredential'
import { CreateMachineStateStore1708098041262 } from './7-CreateMachineStateStore'
import { CreatePhysicalAddressTable1708098041262 } from './8-CreatePhysicalAddressTable'

/**
* The migrations array that SHOULD be used when initializing a TypeORM database connection.
Expand All @@ -16,7 +15,7 @@ import { CreatePhysicalAddressTable1708098041262 } from './8-CreatePhysicalAddre
*/

// Individual migrations per purpose. Allows parties to not run migrations and thus create/update tables if they are not using a particular feature (yet)
export const DataStoreContactMigrations = [CreateContacts1659463079429, CreateContacts1690925872318, CreatePhysicalAddressTable1708098041262]
export const DataStoreContactMigrations = [CreateContacts1659463079429, CreateContacts1690925872318]
export const DataStoreIssuanceBrandingMigrations = [CreateIssuanceBranding1659463079429]
export const DataStoreStatusListMigrations = [CreateStatusList1693866470000]
export const DataStoreEventLoggerMigrations = [CreateAuditEvents1701635835330]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,24 @@ export class CreateContacts1659463079428 implements MigrationInterface {
await queryRunner.query(
`ALTER TABLE "Connection" ADD CONSTRAINT "FK_Connection_identityId" FOREIGN KEY ("identityId") REFERENCES "Identity"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
)

await queryRunner.query(`
CREATE TABLE "PhysicalAddress" (
"id" text PRIMARY KEY NOT NULL,
"type" varchar(255) NOT NULL,
"street_name" varchar(255) NOT NULL,
"street_number" varchar(255) NOT NULL,
"postal_code" varchar(255) NOT NULL,
"city_name" varchar(255) NOT NULL,
"province_name" varchar(255) NOT NULL,
"country_code" varchar(2) NOT NULL,
"building_name" varchar(255),
"partyId" uuid,
"created_at" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
"last_updated_at" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT "FK_PhysicalAddressEntity_partyId" FOREIGN KEY ("partyId") REFERENCES "Party" ("id") ON DELETE CASCADE
);`
);
}

public async down(queryRunner: QueryRunner): Promise<void> {
Expand All @@ -59,5 +77,6 @@ export class CreateContacts1659463079428 implements MigrationInterface {
await queryRunner.query(`DROP TYPE "public"."CorrelationIdentifier_type_enum"`)
await queryRunner.query(`DROP INDEX "public"."IDX_BaseConfigEntity_type"`)
await queryRunner.query(`DROP TABLE "BaseConfigEntity"`)
await queryRunner.query(`DROP TABLE "PhysicalAddress"`)
}
}

This file was deleted.

0 comments on commit 0862dbd

Please sign in to comment.