Skip to content

Migration: add opp-inactive to opportunity_status_enum #412

@nadavosa

Description

@nadavosa

Summary

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).
  • FE PR Fix:Opportunity statuses #332 fe#333 has an Inactive status option that currently maps to `opp-past` as a workaround.
  • SDK needs `INACTIVE = "opp-inactive"` added to `OpportunityStatusType` (tracked separately).

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

  • SDK issue: Add INACTIVE to OpportunityStatusType enum

Unblocks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions