yesodweb / yesodweb/persistent

persistent-mysql migration: BLOB/TEXT column ... can't have a default value

Open
#563 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

when I start my application (for the first time, so it tries to migrate an existing DB), I get

Migrating: ALTER TABLE `aufgabe` ALTER COLUMN `Name` DROP DEFAULT
autotool-yesod: ConnectionError {errFunction = "query", errNumber = 1101, errMessage = "BLOB/TEXT column 'Name' can't have a default value"}

When I run this command in the DB directly:

MariaDB [____test]> ALTER TABLE `aufgabe` ALTER COLUMN `Name` DROP DEFAULT;
ERROR 1101 (42000): BLOB/TEXT column 'Name' can't have a default value

This also happens with mysql server version 5.5.49.

The fix would be to just not run this ALTER TABLE query? Indeed, to not create it? Because the DEFAULT is not there in the first place, so there's no reason to DROP it:

mysql> show create table aufgabe;
CREATE TABLE `aufgabe` (
  `ANr` int(11) NOT NULL AUTO_INCREMENT,
  `Name` text CHARACTER SET utf8 NOT NULL,
...

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

No file or test is named. Start by locating the persistent-mysql migration code that emits the reported ALTER TABLE query, reproduce it against the stated MySQL/MariaDB setup, and verify that migrations no longer fail when dropping a default from the BLOB/TEXT column.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.