Skip to content

Bug: Multi-file Prisma schema configuration fails to correctly locate migrations folder #20

@Karoid

Description

@Karoid

When configuring the Multi-file Prisma schema using the package.json approach as documented here, the migrations folder and SQL files are created in the wrong location.

Configuration ⚙️

The following configuration was used in package.json:

"prisma": {
  "schema": "./prisma"
}

Observed Behavior 🐛

The SQL files for migrations (those with the descriptive comment) are being generated in the root ./migrations folder instead of the expected ./prisma/migrations folder.

Furthermore, the SQL in these incorrectly placed files is not being applied (migrations fail to execute or are not tracked correctly).

Expected Behavior ✅

When package.json is configured with "schema": "./prisma", running Prisma migration commands (e.g., prisma migrate dev) should:

Create the migrations folder at ./prisma/migrations.

Generate the SQL migration files inside ./prisma/migrations.

Successfully apply the SQL schema changes to the database.

Steps to Reproduce 👣

Set up a project with the prisma config in package.json as shown above.

Create a multi-file schema inside the ./prisma directory.

Run a migration command, e.g., npx prisma migrate dev --name init.

Observe that the new migration folder is created at ./migrations (root), not ./prisma/migrations.

Attempt to run the migration. (It will likely fail or not apply the schema correctly).

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions