You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add `opp-inactive` to the PostgreSQL `opportunity_status_enum` type and create a TypeORM migration for it.
Motivation
Notion data has opportunities with statuses: Cancelled by us, Cancelled by RAC, Cancelled by refugee, Inactive — these should map to `opp-inactive` (distinct from `opp-past` = completed/done).
```ts
import { MigrationInterface, QueryRunner } from "typeorm";
export class AddOppInactiveStatus implements MigrationInterface {
name = "AddOppInactiveStatus";
public async up(queryRunner: QueryRunner): Promise {
await queryRunner.query(
`ALTER TYPE "public"."opportunity_status_enum" ADD VALUE IF NOT EXISTS 'opp-inactive'`
);
}
public async down(queryRunner: QueryRunner): Promise {
// PostgreSQL does not support removing enum values directly.
// To rollback: recreate the enum without opp-inactive and cast all columns.
// Only do this if no rows use opp-inactive.
}
}
```
No endpoint changes needed
The existing `PATCH /opportunity/:id` endpoint already accepts `statusOpportunity` from the SDK enum — once the SDK is updated and this migration runs, it will accept `opp-inactive` automatically.
Depends on
SDK issue: Add INACTIVE to OpportunityStatusType enum
Summary
Add `opp-inactive` to the PostgreSQL `opportunity_status_enum` type and create a TypeORM migration for it.
Motivation
Migration to create
File: `src/data/migrations/-add-opp-inactive-status.ts`
```ts
import { MigrationInterface, QueryRunner } from "typeorm";
export class AddOppInactiveStatus implements MigrationInterface {
name = "AddOppInactiveStatus";
public async up(queryRunner: QueryRunner): Promise {
await queryRunner.query(
`ALTER TYPE "public"."opportunity_status_enum" ADD VALUE IF NOT EXISTS 'opp-inactive'`
);
}
public async down(queryRunner: QueryRunner): Promise {
// PostgreSQL does not support removing enum values directly.
// To rollback: recreate the enum without opp-inactive and cast all columns.
// Only do this if no rows use opp-inactive.
}
}
```
No endpoint changes needed
The existing `PATCH /opportunity/:id` endpoint already accepts `statusOpportunity` from the SDK enum — once the SDK is updated and this migration runs, it will accept `opp-inactive` automatically.
Depends on
Unblocks