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
Add default board to new projects, remove uncategorized pseudo-board #29874
Conversation
Wait, the default board is a pseudo-board? |
Line 258 in 16e3600
|
@lng2020 The default logic will apply if all columns are deleted which in fact can easily happen. Also, we cannot possibly do this change retroactively for all existing projects which currently display this default pseudo-column. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really need the configuration? Maybe we can hardcode it and make it an option when we think it's necessary.
models/migrations/v1_22/v292.go
Outdated
// CheckProjectColumnsConsistency ensures there is exactly one default board per project present | ||
func CheckProjectColumnsConsistency(x *xorm.Engine) error { | ||
var projects []project.Project | ||
if err := x.SQL("SELECT DISTINCT `p`.`id`, `p`.`creator_id` FROM `project` `p` WHERE (SELECT COUNT(*) FROM `project_board` `pb` WHERE `pb`.`project_id` = `p`.`id` AND `pb`.`default` = ?) != 1", true). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to have pagination in this migration!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Honestly I have no idea what you mean or how to do it 🙈
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Itterate over it in batches ... just look at older migrations
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
e.g.
gitea/models/migrations/v1_21/v276.go
Line 55 in 274bc00
limit := setting.Database.IterateBufferSize |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh so the thing I did before 😆
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uh you did?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, and then it was removed again.
Also, I don't quite see the benefit of batching here.
How does it help with anything?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess the only reason to batch is when amount of project boards is really massive and the SQL operation would risk running into timeouts maybe.
On the other hand, batched also brings the problem that the operation is not atomic, but if it's idempotent, it wouldn't matter when it's interrupted in the middle.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@6543 looking good to you? |
Finally 🎉 |
* origin/main: (108 commits) Fix table alignment classes (go-gitea#30144) Add default board to new projects, remove uncategorized pseudo-board (go-gitea#29874) Fix loading spinner on ContextPopup (go-gitea#30145) Fix download buttons on branches page (go-gitea#30147) Relax generic package filename restrictions (go-gitea#30135) Remove jQuery class from the common admin functions (go-gitea#30137) Remove jQuery class from the reaction selector (go-gitea#30138) Forbid jQuery `.attr` (go-gitea#30116) Refactor render (go-gitea#30136) Fix: Organization Interface Display Issue (go-gitea#30133) Remove jQuery `.attr` from the Fomantic dropdowns (go-gitea#30114) Remove jQuery `.attr` from the common admin functions (go-gitea#30115) Remove jQuery from the create/rename branch modals (except Fomantic) (go-gitea#30109) Remove fomantic label module (go-gitea#30081) Fix bug for markdown rendering of blockquote (go-gitea#30130) Fix: The interface is broken when modifying code comments under mobile devices (go-gitea#30125) When the title in the issue has a value, set the text cursor at the end of the text. (go-gitea#30090) Load attachments for code comments (go-gitea#30124) Upgrade fabric to 6.0.0-beta20 (go-gitea#30121) Fix click handler in job-step-summary (go-gitea#30122) ...
Limit(limit, start). | ||
Find(&projects); err != nil { | ||
return err | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry but this migration seems broken ....
If the "SELECT" results are stable and never change, this for
loop is right.
BUT, by each SELECT
and for-loop, the "project boards" are changed. The next SELECT
, it should still process the first page results, but not skip start
.
For example: 150 projects.
- First loop:
SELECT
gets 1-50 projects and updates them. - Second loop:
SELECT
gets "the second page" from "51-150", then it gets 101-150 projects. - Then the 51-100 projects are never migrated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will send a PR to fix it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* giteaofficial/main: (63 commits) Apply to become a maintainer (go-gitea#30151) Refactor markdown render (go-gitea#30139) Drag-and-drop improvements for projects and issue pins (go-gitea#29875) Fix table alignment classes (go-gitea#30144) Add default board to new projects, remove uncategorized pseudo-board (go-gitea#29874) Fix loading spinner on ContextPopup (go-gitea#30145) Fix download buttons on branches page (go-gitea#30147) Relax generic package filename restrictions (go-gitea#30135) Remove jQuery class from the common admin functions (go-gitea#30137) Remove jQuery class from the reaction selector (go-gitea#30138) Forbid jQuery `.attr` (go-gitea#30116) Refactor render (go-gitea#30136) Fix: Organization Interface Display Issue (go-gitea#30133) Remove jQuery `.attr` from the Fomantic dropdowns (go-gitea#30114) Remove jQuery `.attr` from the common admin functions (go-gitea#30115) Remove jQuery from the create/rename branch modals (except Fomantic) (go-gitea#30109) Remove fomantic label module (go-gitea#30081) Fix bug for markdown rendering of blockquote (go-gitea#30130) Fix: The interface is broken when modifying code comments under mobile devices (go-gitea#30125) When the title in the issue has a value, set the text cursor at the end of the text. (go-gitea#30090) ... # Conflicts: # templates/user/dashboard/issues.tmpl
Fix #29874 (comment) - The migration of v292 will miss many projects. These projects will have no default board. This PR introduced a new migration number and removed v292 migration. - This PR also added the missed transactions on project-related operations. - Only `SetDefaultBoard` will remove duplicated defaults but not in `GetDefaultBoard`
Fix go-gitea/gitea#29874 (comment) - The migration of v292 will miss many projects. These projects will have no default board. This PR introduced a new migration number and removed v292 migration. - This PR also added the missed transactions on project-related operations. - Only `SetDefaultBoard` will remove duplicated defaults but not in `GetDefaultBoard` (cherry picked from commit 40cdc84b368cce8328b4b49ea5ecf1c5fa040300)
- as title - remove logic about zero `project_board_id` in `project_issue` table and fix some related test data. because after go-gitea#29874, `project_board_id` willn't be zero - some small refactoring Signed-off-by: a1012112796 <1012112796@qq.com>
On creation of an empty project (no template) a default board will be created instead of falling back to the uneditable pseudo-board.
Every project now has to have exactly one default boards. As a consequence, you cannot unset a board as default, instead you have to set another board as default. Existing projects will be modified using a cron job, additionally this check will run every midnight by default.
Deleting the default board is not allowed, you have to set another board as default to do it.
Fixes #29873
Fixes #14679 along the way
Fixes #29853
Co-authored-by: delvh dev.lh@web.de