-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Remove repo unit index #2621
Remove repo unit index #2621
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2621 +/- ##
==========================================
+ Coverage 27.11% 27.11% +<.01%
==========================================
Files 86 86
Lines 17064 17062 -2
==========================================
Hits 4627 4627
+ Misses 11759 11757 -2
Partials 678 678
Continue to review full report at Codecov.
|
7fcd211
to
c927767
Compare
@Morlinest In the future, could you please not create PRs than depend on other, unmerged PRs? If you don't create the PR until the things it depends on are finished, that would make things a lot simpler for reviewers. |
@ethantkoenig It doesn't "need" anything, I want to merge another PR only because there is another bug that will pop up after merge. I know it only because I've tested it and also know, there is already fix for it. I think #2603 will also fix it. I am writing comments about merges as bug prevention... Edit: I think it's totally legal and common to reference other issues/pullrequests. |
@Morlinest So this PR fixes a bug that does not currently exist, but will exist after #2601 is merged? |
models/migrations/v45.go
Outdated
UnitTypeReleases: 3, | ||
UnitTypeWiki: 4, | ||
UnitTypeExternalWiki: 4, | ||
} |
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.
Why is this different than creating the RepoUnits!?
UnitTypeExternalWiki is here 4 but in when saving settings it is the Idx of models.Units, thus 6?
Definitely not correct, needs to be changed.
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.
@daviian I think this is correct and doesn't need any changes. RepoUnit
contains UnitType
, see line below.
Please see "unit.go" file. It's copied from there. The only thing I did was to replace map[UnitType]Unit
for map[UnitType]int
to reduce number of lines added (around 60 lines) and copied only Unit.Idx
values. All Index
values in RepoUnit
table with UnitTypeExternalWiki
should be updated to 4
as it is in units
map. Where do you see 6?
@ethantkoenig It is a bug, that has no visible impact currently, but the |
@ethantkoenig Please look at files changed. Do you see 2 different ways of setting |
This may be a stupid question, but where exactly is the Also, if the index should be uniquely determined by the |
@ethantkoenig That's not a stupid question. As I wrote before in #2603
it can be removed. But first we need to check code and rewrite Home handler at least. I was focused on making quick fix of bug instead. But maybe I can rewrite #2601 to fix |
c927767
to
e64156a
Compare
e64156a
to
eff2b8f
Compare
@ethantkoenig Changed this PR to completly remove @daviian With this two changes (if aprooved and merged) will not be #2603 needed anymore. Right? |
models/migrations/v45.go
Outdated
) | ||
|
||
func removeIndexColumnFromRepoUnitTable(x *xorm.Engine) (err error) { | ||
if _, err := x.Exec("ALTER TABLE repo_unit DROP COLUMN index"); err != nil { |
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.
Columns can not be dropped on sqlite. Please add if to switch like in this migration:
gitea/models/migrations/v40.go
Line 43 in 1739e84
switch { |
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
LGTM |
LGTM |
conflicted |
@lunny fixed |
FixIndex
values inRepoUnit
.~~#2601 has to be merged first.Edit: #2601 or #2603 can fix problems with accessing repo pages with this changes.Removes unused
RepoUnit.Index