Skip to content

Failing Migrations when upgrading from 1.11 to 1.12/1.12.1 (docker) #1880

@ArbiterGR

Description

@ArbiterGR

Issue Description

I'm getting the following error upon applying migration on the new version:

`A migration failed to apply. New migrations cannot be applied before the error is recovered from. Read more about how to resolve migration issues in a production database: https://pris.ly/d/migrate-resolve

Migration name: 20250522054050_add_organisations

Database error code: 23502

Database error:
ERROR: null value in column "organisationId" of relation "OrganisationGroup" violates not-null constraint
DETAIL: Failing row contains (org_group_xirhimhddwenzbbf, null, INTERNAL_TEAM, MEMBER, null, 2, ADMIN).

DbError { severity: "ERROR", parsed_severity: Some(Error), code: SqlState(E23502), message: "null value in column "organisationId" of relation "OrganisationGroup" violates not-null constraint", detail: Some("Failing row contains (org_group_xirhimhddwenzbbf, null, INTERNAL_TEAM, MEMBER, null, 2, ADMIN)."), hint: None, position: None, where_: None, schema: Some("public"), table: Some("OrganisationGroup"), column: Some("organisationId"), datatype: None, constraint: None, file: Some("execMain.c"), line: Some(1972), routine: Some("ExecConstraints") }`

By rolling back the failed migration using "npx prisma migrate resolve --rolled-back "20250522054050_add_organisations" --schema ../../packages/prisma/schema.prisma" i'm able to downgrade to version 1.11 which works.

Steps to Reproduce

No response

Expected Behavior

No response

Current Behavior

No response

Screenshots (optional)

No response

Operating System [e.g., Windows 10]

No response

Browser [e.g., Chrome, Firefox]

No response

Version [e.g., 2.0.1]

No response

Please check the boxes that apply to this issue report.

  • I have searched the existing issues to make sure this is not a duplicate.
  • I have provided steps to reproduce the issue.
  • I have included relevant environment information.
  • I have included any relevant screenshots.
  • I understand that this is a voluntary contribution and that there is no guarantee of resolution.
  • I want to work on creating a PR for this issue if approved

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions