Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

`@default` on a field of a `@map`-ed enum emits the enum name as the column default

Open Beginner friendly
#2,868 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
postgresql, typescript
Domain
backend, databases

Research direction

Read packages/orm/src/client/helpers/schema-db-pusher.ts, focusing on the col.defaultTo(fieldDef.default) branch and the nearby @map handling. Find and run the existing tests for schema pushing; done when a mapped enum default uses its mapped database value in the generated DDL and pushing the repro schema to PostgreSQL succeeds.

Written by the indexing model from the issue text.

Description

runtime

Summary

When an enum member has a @map-ed value and a field uses it as the default, db push emits the enum name rather than the mapped database value as the column default. On PostgreSQL table creation fails.

Repro

enum PostStatus {
    DRAFT  @map('draft')
    ACTIVE @map('active')
}

model User {
    id     Int        @id @default(autoincrement())
    status PostStatus @default(DRAFT)
}

Pushing this schema to PostgreSQL fails with:

invalid input value for enum "PostStatus": "DRAFT"

The generated DDL contains DEFAULT 'DRAFT' while the PostgreSQL enum type only has the values 'draft' and 'active'.

Where

packages/orm/src/client/helpers/schema-db-pusher.ts, the col.defaultTo(fieldDef.default) branch. The enum type itself is created with the mapped values (see the @map handling a few lines above in the same file), but the default is passed through unmapped.

Found while probing mapped-enum behavior for #2807.

Dominant language
TypeScript
Stars
2.9k
Forks
157
Avg merge
11h 42m
Merged PRs (30d)
20

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from zenstackhq/zenstack

All issues in zenstackhq/zenstack

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.