Skip to content

Support configuring default ID type in generator.yaml #3665

Open

Description

@SandPod

Problem to Solve

Currently, all generated tables default to using int as the ID type. Once #3659 is merged, it will be possible to override this and use UUID instead.

But the current solution requires a manual override for each model.
Some projects might benefit from using UUIDs as the default value for id types and manual overrides for when int ids are required.

Proposal

Add support for configuring the default ID type at the project level via generator.yaml. This setting should be read by serverpod generate, influencing how IDs are generated for all tables by default.

Example:

idType: uuid

This configuration would instruct the code generator to use uuid as the default type for all new tables unless explicitly overridden.

Use Case

A team building a system with distributed services wants to use UUIDs for better uniqueness guarantees across services. They can configure this once in generator.yaml, ensuring consistency across all table definitions without manual overrides.

Alternatives

  • Continue requiring per-table ID type overrides (status quo)

Additional context

This configuration should apply per module.

How experienced are you with this library?

Expert - Experienced and comfortable with using this library in complex projects

Are you interested in working on a PR for this?

  • I want to work on this

Activity

  1. added
    enhancement
    area: models
    area: configuration
    on Jun 17, 2025
  2. moved this from Inbox 📫 to Backlog 🗂️ in Serverpod Frameworkson Jun 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: configurationarea: modelsenhancement

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions