Skip to content

GitHub issue names can be too long and make migrations fail (Postgres/MySQL) #28846

Closed
@TristanWasTaken

Description

@TristanWasTaken

Description

I tried to migrate the repository https://github.com/tachiyomiorg/tachiyomi with all migration options
The migration always failed at one of the issues with one of these errors:

  • Postgres: pq: value too long for type character varying(255)
  • MySQL (MariaDB): Error 1406 (22001): Data too long for column 'name' at row 1

Logs from console:

postgres-test  | 2024-01-14 11:57:36.882 UTC [88] ERROR:  value too long for type character varying(255)
postgres-test  | 2024-01-14 11:57:36.882 UTC [88] STATEMENT:  INSERT INTO "issue" ("repo_id","index","poster_id","original_author","original_author_id","name","content","milestone_id","priority","is_closed","is_pull","num_comments","ref","pin_order","deadline_unix","created_unix","updated_unix","closed_unix","is_locked") VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19) RETURNING "id"
gitea-test     | 2024/01/14 11:57:36 ...ices/task/migrate.go:61:func1() [E] runMigrateTask[1] by DoerID[1] to RepoID[1] for OwnerID[1] failed: pq: value too long for type character varying(255)
gitea-test     | 2024/01/14 11:57:36 ...ervices/task/task.go:53:handler() [E] Run task failed: pq: value too long for type character varying(255)

After changing the name field type from character varying(250) NULL to character varying(1200) NULL, the migration succeeded.

Here is a dump of the issue table with the query SELECT * FROM issue WHERE LENGTH(name) > 250;
https://gist.github.com/TristanWasTaken/7cb2c9b2a5c537822796ccb4fc25f513
Issues: tachiyomiorg/tachiyomi#3495, tachiyomiorg/tachiyomi#2337, tachiyomiorg/tachiyomi#4321, tachiyomiorg/tachiyomi#4379, tachiyomiorg/tachiyomi#3897, tachiyomiorg/tachiyomi#4898, tachiyomiorg/tachiyomi#4978, tachiyomiorg/tachiyomi#5066

The migration is still ongoing on the Gitea demo site: https://try.gitea.io/TristanWasTaken/tachiyomi
It'll take ~8h to do a full migration. Or at least that's how long it took on my instance.

Gitea Version

1.21.3

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

gitea_issue_mysql

Git Version

No response

Operating System

No response

How are you running Gitea?

docker gitea/gitea:1.21.3 image, with postgres and redis
Please note that I also tried with memory instead of redis, mysql (MariaDB) as database and pretty much every variation except sqlite

Database

PostgreSQL

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions