yesodweb / yesodweb/persistent

Possible issue with OnDeleteCascade

Open
#1,347 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug Newcomer
Dominant language
Haskell
Stars
486
Forks
306
PR merge metrics
No merged PRs in 30d

Description

I don't have a concrete and minimal reproduction for this, but it appears this does not add the ON DELETE CASCADE fk correctly:

Report sql=reports
  Id UUID default=uuid_generate_v4()
  userId UserId
  created UTCTime default=now()
  companyQueryId (Maybe CompanyQueryId) OnDeleteCascade
  recipient Text Maybe
  deriving Show

…whereas this one does:

Report sql=reports
  Id UUID default=uuid_generate_v4()
  userId UserId
  created UTCTime default=now()
  companyQueryId CompanyQueryId Maybe OnDeleteCascade
  recipient Text Maybe
  deriving Show

Versions:

$ ghc-pkg list | grep persistent
    persistent-2.13.1.1
    persistent-postgresql-2.13.0.3
    persistent-sqlite-2.13.0.3
    persistent-template-2.12.0.0
    yesod-persistent-1.6.0.7

My assumption that the former syntax would be supported is based on this notice in the changelog.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the two Report entity declarations in the issue and the persistent 2.13.1.1 changelog entry linked there. Reproduce both forms with the listed persistent packages and inspect the generated PostgreSQL foreign-key definition; done when the supported syntax and resulting ON DELETE CASCADE behavior are confirmed by a focused regression test or the issue is clarified.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.