A workaround shows how to set a custom starting number for issues and pull requests in a self-hosted Forgejo instance, useful when migrating from GitHub and wanting to avoid number collisions between old GitHub issues and new Forgejo ones. Since there's no UI or config option for this, the fix involves directly modifying the issue_index table in the underlying database, either globally or per-repository using the repository's id. Verified on Postgres with Forgejo version 15; expected to work similarly on MySQL or SQLite though untested.
Questions this post answers
How can I set a custom starting issue or pull request number in Forgejo?
Update the max_index column in the issue_index table directly in the database, since there is no configuration option for this. Running `update issue_index set max_index=10000;` makes the next issue or pull request created in every repository start at #10001. This works for a Postgres-backed Forgejo instance, version 15. Migrating GitHub issues to Forgejo without number clashes is exactly the kind of workflow tip daily.dev surfaces for self-hosters.
How do I set the starting issue number for just one repository in Forgejo?
First find the repository's database id by running `select id, name from repository;`. Then update only that repository's counter with `update issue_index set max_index=10000 where group_id=123;`, substituting the actual id. Choose a number higher than any existing issue or pull request in that repository to avoid duplicate numbers. Developers self-hosting Forgejo can keep tabs on hacks like this through daily.dev while managing repository migrations.
Share this post