-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
API: Allow setting the issue number when creating an issue #7790
Comments
@argv-minus-one I think we should not do that. We have a migrations package https://github.com/go-gitea/gitea/tree/master/modules/migrations and we can migrate almost all data from github. Users can contribute this package and migrate via Gitea API. |
I see. I'll take a look, but I'm not sure if I have time to learn Go and Gitea's internals right now. In the mean time, I've posted issue #7802 for my specific use-case, which is importing from Bugzilla. |
The migrations package seems designed for migrating Git repositories and associated data from GitHub-like sites, and would need a pretty major redesign to handle migrating anything else, such as issues from a separate issue tracker like Bugzilla. |
@argv-minus-one I never used bugzilla and I want to know why do you want a special issue number? |
I want to preserve the Bugzilla issue numbers when importing them into Gitea, because I have commit messages and emails that reference them by issue number (like “fixes #123” and “please look at bug 234”). |
This looks like a one-time procedure. I'd rather write a script to generate the |
I don't see how this could be implemented without breaking a lot of stuff imho |
It could, by requiring that the override-issue-number be larger than every issue number already used for this repository. One should limit this ability to the repo owner, obviously. |
I don't see any sequence for the
What would break?
That would be fine for me, but out of curiosity, why not allow any unused issue number to be used? The database schema already contains a |
If you see it from the point of view of your database, there might be no problems. But Gitea must support other database engines that won't play nicely with that kind of tinkering. For instance, Postgres uses sequences, while MS SQL Server and MySQL use auto-increment IDs. SQLite is used for light loads where a It's pretty buried in the docs, but SQLite is suggested only for tiny installations. |
I see. Well, Gitea contains a Anyway, I threw together a Gitea instance on PostgreSQL, then tried creating an issue, increasing its issue number (from #1 to #2) with an Is there anything else that might break when I do this? Note, by the way, that the Normal database auto-increment can't be used for this. PostgreSQL sequences don't seem up to the task, either, unless Gitea were to I only know of two ways to deal with this: something along the lines of PostgreSQL seems to prefer
Whereas
If I'm reading this right, PostgreSQL answers a |
@argv-minus-one You are exactly right, as I was getting confused with the |
If somebody deleted some issues, for whatever reason, there might be commits referencing the issue. If somebody recycled that issue number, it could become very confusing fast. So as your use case does not require for them to be inserted out-of-order, this could be a reasonable restriction. Btw. temporarily creating issues with the desired index - 1 in the database while importing the issues from bugzilla would result in them being created with the same issue number. It's a dirty hack, but it would work. |
@jpicht so gitea haven't support deleting issues yet. As I said above, it could be implemented to satisfy migrations |
@guillep2k Yes, please feel free to do that. |
It doesn't seem a general/feasible solution.
The proper solution would be using a separate mapping table or a separate field. |
[x]
):Description
Please allow creating issues through the API (
POST /api/v1/repos/{user}/{repository}/issues
) with a specific issue number/index. This would allow importing issues from other issue trackers while preserving their issue numbers.Workaround
This can also be accomplished by changing the database field directly, after the issue is created, using a query like:
…where the first parameter is the desired issue number, and the second parameter is the
id
field in the JSON response from creating the issue.The text was updated successfully, but these errors were encountered: