Skip to content

Allow configuration of output directory for generated migrations #3368

Open

Description

@SandPod

Problem to Solve

Currently, migration files are always generated in a fixed directory. This limits flexibility for developers who want to organize generated files differently—such as grouping them by module, placing them in a custom generated/ folder, or integrating with custom tooling.

Proposal

Support configuring the output directory for generated migration files through both:

  1. CLI flag:

    serverpod create-migration --dir=custom/migrations
  2. generator.yaml configuration:

    migration_path: custom/migrations

CLI flag should take precedence over the configuration file.

The generator should resolve the path relative to the project root and create the directory if it doesn’t exist.

Use Case

A project may want to use different migration directories for different migrations.

Alternatives

  • Manually move generated files after generation (error-prone).
  • Use symlinks or build scripts (adds complexity).
  • Leave as-is and enforce strict directory structure (limits flexibility).

Additional context

This aligns with patterns already used for configuring other outputs.

How experienced are you with this library?

None

Are you interested in working on a PR for this?

  • I want to work on this

Activity

  1. added
    area: cli
    enhancement
    on Mar 31, 2025
  2. added
    stake: interstellar request
    on Nov 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area: clienhancementstake: interstellar request

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions