yesodweb / yesodweb/persistent

migrations: adds foreign key, but should change column type first.

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

Nobody has claimed this yet.

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

Description

(persistent-mysql-2.13.1.3, other packages from lts-19/ghc-9.0.2, mysqld Ver 10.5.13-MariaDB)

The migration script wants to add a foreign key, and for that, it needs to modify the type of the column in the table that is referenced. These statements are not in the proper order, so it's rejected (errno: 150 "Foreign key constraint is incorrectly formed") by mariadb. I can work around by doing all CHANGE statements first (literally - grepping the text). The migration printer could do that?

(https://gitlab.imn.htwk-leipzig.de/autotool/all0/-/issues/882#note_42290)

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 at the migration printer and trace how CHANGE statements and foreign-key additions are ordered. Reproduce the reported migration against MariaDB, then verify that column type changes are emitted before foreign-key additions and that the migration is accepted.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.