Skip to content

CASCADE relation not applied in Postgres #810

Closed

Description

@tomitrescak

Hi

I have following model

model User {
  id              String                @default(cuid()) @id
  processes       BpmnProcessInstance[] @relation(name: "ProcessOwner", onDelete: CASCADE)
}

model BpmnProcessInstance {
  id            String                    @default(cuid()) @id
  owner         User                      @relation(name: "ProcessOwner")
}

When this is lifted to Postgres DB, the Foreign Key is NOT set to CASCADE, but SET NULL.

Activity

  1. tomitrescak commented on Oct 22, 2019

    @tomitrescak
    ContributorAuthor

    This is what is generated

    CREATE TABLE "public"."BpmnProcessInstance" (
        "id" text NOT NULL,
        "owner" text,
        CONSTRAINT "BpmnProcessInstance_owner_fkey" FOREIGN KEY ("owner") REFERENCES "public"."User"("id") ON DELETE SET NULL,
        PRIMARY KEY ("id")
    );
    
  2. pantharshit00 commented on Oct 22, 2019

    @pantharshit00
    Contributor

    Hi,

    Thanks for reporting. This hasn't been implemented yet. I am closing as a duplicate of https://github.com/prisma/prisma2/issues/267

  3. tomitrescak commented on Oct 22, 2019

    @tomitrescak
    ContributorAuthor

    Hmm, I searched for a related issue, not sure how it escaped my search. Thanks, I'll follow that thread!

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions