Skip to content
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

Fix DBConsistency checks on MSSQL #23132

Merged
merged 1 commit into from
Feb 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions models/issues/label.go
Original file line number Diff line number Diff line change
Expand Up @@ -778,7 +778,7 @@ func CountOrphanedLabels(ctx context.Context) (int64, error) {
norepo, err := db.GetEngine(ctx).Table("label").
Where(builder.And(
builder.Gt{"repo_id": 0},
builder.NotIn("repo_id", builder.Select("id").From("repository")),
builder.NotIn("repo_id", builder.Select("id").From("`repository`")),
)).
Count()
if err != nil {
Expand All @@ -788,7 +788,7 @@ func CountOrphanedLabels(ctx context.Context) (int64, error) {
noorg, err := db.GetEngine(ctx).Table("label").
Where(builder.And(
builder.Gt{"org_id": 0},
builder.NotIn("org_id", builder.Select("id").From("user")),
builder.NotIn("org_id", builder.Select("id").From("`user`")),
)).
Count()
if err != nil {
Expand All @@ -809,7 +809,7 @@ func DeleteOrphanedLabels(ctx context.Context) error {
if _, err := db.GetEngine(ctx).
Where(builder.And(
builder.Gt{"repo_id": 0},
builder.NotIn("repo_id", builder.Select("id").From("repository")),
builder.NotIn("repo_id", builder.Select("id").From("`repository`")),
)).
Delete(Label{}); err != nil {
return err
Expand All @@ -819,7 +819,7 @@ func DeleteOrphanedLabels(ctx context.Context) error {
if _, err := db.GetEngine(ctx).
Where(builder.And(
builder.Gt{"org_id": 0},
builder.NotIn("org_id", builder.Select("id").From("user")),
builder.NotIn("org_id", builder.Select("id").From("`user`")),
)).
Delete(Label{}); err != nil {
return err
Expand Down