yesodweb / yesodweb/persistent

MySQL backend generates foreign keys over length limit

Open
#1,000 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bugfix good first issue MySQL SQL
Dominant language
Haskell
Stars
486
Forks
306
PR merge metrics
No merged PRs in 30d

Description

Currently, persistent-mysql suggests foreign key constraint names that are over MySQL's length limit of 64 characters, which MySQL will throw an error for.

persistent-mysql should generate truncated names that don't go over the length limit. It could use the same logic as is introduced in #996 for truncating Postgres keys, or logic that better matches MySQL's naming conventions.

This issue is discussed in greater detail in #996, which adds tests for it. This issue is mostly to track the issue being resolved for MySQL, since #996 will be closed after it resolves it for Postgres.

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 with the persistent-mysql backend and review the truncation logic and tests introduced in issue #996 for PostgreSQL. Adapt the relevant approach for MySQL, then verify that generated foreign-key names stay within MySQL's 64-character limit and that the associated tests pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell, mysql
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.