Skip to content

chore(jobs): change DEFAULT_MODEL_NAME to camelCase 'backgroundJob' in next major release #1583

@lisa-assistant

Description

@lisa-assistant

Background

In `packages/jobs/src/consts.ts` at line 18-19:

```ts
// TODO: Change this to 'backgroundJob' in the next major release
export const DEFAULT_MODEL_NAME = 'BackgroundJob'
```

Currently `DEFAULT_MODEL_NAME` is `'BackgroundJob'` (PascalCase — the Prisma schema model name). The `PrismaAdapter` then calls `camelCase()` internally to derive the actual db accessor (`db.backgroundJob`). This is confusing because the user-facing `model` option and the internal default use a different casing convention than the actual accessor.

Related TODOs in `packages/jobs/src/adapters/PrismaAdapter/PrismaAdapter.ts`:

  • Line 179: `// TODO: Remove type casting of `options.model` in the next major release`
  • Line 185: `// TODO: Remove the camelCase call in the next major release. It's only here to keep the code backwards compatible`

What needs to be done

In the next major release:

  1. `packages/jobs/src/consts.ts` — Change the default to camelCase:
    ```ts
    export const DEFAULT_MODEL_NAME = 'backgroundJob'
    ```

  2. `packages/jobs/src/adapters/PrismaAdapter/PrismaAdapter.ts` — Remove the internal `camelCase()` conversion and backwards-compat type cast. Users should now pass the camelCase model name directly (matching the Prisma client accessor). Update the JSDoc comment on the `model` option accordingly.

  3. `packages/jobs/src/adapters/PrismaAdapter/tests/PrismaAdapter.test.ts` — Update the test that asserts `adapter.model === DEFAULT_MODEL_NAME`.

  4. `packages/cli/src/commands/setup/jobs/jobsHandler.js` — The schema template still uses `model BackgroundJob` (PascalCase) — this stays correct for the Prisma schema, but the docs/handler should clarify that users pass `'backgroundJob'` (camelCase) to the adapter.

Why

Using PascalCase as the default for the adapter `model` option is inconsistent with how Prisma client exposes models (`db.backgroundJob`). Switching to camelCase as the canonical input makes the API more intuitive and removes the implicit `camelCase()` conversion that can mask typos in custom model names.

Migration note

This is a breaking change — users who rely on the default and don't set `model` explicitly will see no change in behavior. Users who pass `model: 'BackgroundJob'` explicitly will need to change to `model: 'backgroundJob'`. Add a migration guide entry for this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions