mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-09-07 22:25:42 +00:00
fix: rm email and phone on exteranl profile
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
import { MigrationInterface, QueryRunner } from 'typeorm';
|
||||
|
||||
/**
|
||||
* Contact email/phone for an external profile is sourced from IAM (the user's
|
||||
* identity) and from the company record, so the duplicated `email`/`phone`
|
||||
* columns on external_profiles are redundant and are dropped. Dropping `email`
|
||||
* also removes its UNIQUE constraint.
|
||||
*/
|
||||
export class DropEmailPhoneFromExternalProfiles1820000000011
|
||||
implements MigrationInterface
|
||||
{
|
||||
name = 'DropEmailPhoneFromExternalProfiles1820000000011';
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE freight.external_profiles DROP COLUMN IF EXISTS email;`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE freight.external_profiles DROP COLUMN IF EXISTS phone;`,
|
||||
);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
// Re-added as nullable (the original email was UNIQUE NOT NULL) since the
|
||||
// dropped values cannot be recovered to satisfy those constraints.
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE freight.external_profiles ADD COLUMN IF NOT EXISTS email varchar(150);`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE freight.external_profiles ADD COLUMN IF NOT EXISTS phone varchar(20);`,
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user