---
title: "Forgejo hack: How to set a starting issue and pull request number"
url: https://daily.dev/posts/forgejo-hack-how-to-set-a-starting-issue-and-pull-request-number-fpkiqfmw7
source_url: https://blog.miguelgrinberg.com/post/forgejo-hack-how-to-set-a-starting-issue-and-pull-request-number
type: article
source: "Miguel Grinberg"
published: 2026-08-25T13:39:07.739Z
updated: 2026-08-25T13:40:37.920Z
tags: ["database", "self-hosting", "forgejo"]
reading_time: 3
upvotes: 0
comments: 0
language: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Forgejo hack: How to set a starting issue and pull request number

**[Miguel Grinberg](https://daily.dev/sources/miguelgrinberg)** · 3 min read · 0 upvotes · 0 comments

## Summary

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.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://blog.miguelgrinberg.com/post/forgejo-hack-how-to-set-a-starting-issue-and-pull-request-number>

## Questions this post answers

### How do I set a custom starting issue number in Forgejo so it doesn't collide with existing GitHub issue numbers after migration?

Set the starting number by directly updating the issue_index table in the Forgejo database, since there is no configuration option for this in the admin UI. Run 'update issue_index set max_index=10000;' to apply it to all repositories, or add 'where group_id=123' with the repository's database id to target a single repo. The next issue or pull request created will then start at #10001. This was verified on a Postgres-backed Forgejo version 15 instance.

_daily.dev surfaces practical self-hosting fixes like this for teams migrating off GitHub to Forgejo._

### How can I avoid duplicate issue numbers when migrating a repository from GitHub to Forgejo?

Leave existing GitHub issues and pull requests where they are, and configure the new Forgejo instance to start numbering from a high offset such as 10000, so any number below that threshold is understood to reference GitHub and anything above it is native to Forgejo. This requires a direct database edit to the issue_index table's max_index column, since Forgejo has no built-in setting for it.

_Developers weighing GitHub-to-Forgejo migrations can find hands-on tips like this through daily.dev._

## Similar posts on daily.dev

- [Forgejo v16.0 is available](https://daily.dev/posts/forgejo-v16-0-is-available-vslb3fjkg) · Lobsters · 1 upvotes · 0 comments

---

Tags: [#database](https://daily.dev/tags/database), [#self-hosting](https://daily.dev/tags/self-hosting), [#forgejo](https://daily.dev/tags/forgejo)

[View this post on daily.dev](https://daily.dev/posts/forgejo-hack-how-to-set-a-starting-issue-and-pull-request-number-fpkiqfmw7)
