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

add upload_token_required_for_public_repos, backfill and make non-nullable #373

Merged
merged 6 commits into from
Oct 3, 2024
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
change update query around
  • Loading branch information
nora-codecov committed Oct 1, 2024
commit 4a185392ec9fc39603b2d1a0799244b9d7b09a79
Original file line number Diff line number Diff line change
@@ -7,8 +7,8 @@

def backfill_upload_token_required_for_public_repos(apps, _):
Owner = apps.get_model("codecov_auth", "Owner")
n_updated = Owner.objects.filter(
upload_token_required_for_public_repos__isnull=True
n_updated = Owner.objects.exclude(
upload_token_required_for_public_repos=True
).update(upload_token_required_for_public_repos=True)
return n_updated

@@ -19,7 +19,7 @@ class Migration(migrations.Migration):
--
-- Alter field upload_token_required_for_public_repos on owner
--
UPDATE "owners" SET "upload_token_required_for_public_repos" = true WHERE "upload_token_required_for_public_repos" IS NULL; SET CONSTRAINTS ALL IMMEDIATE;
UPDATE "owners" SET "upload_token_required_for_public_repos" = true WHERE "upload_token_required_for_public_repos" IS NOT true; SET CONSTRAINTS ALL IMMEDIATE;
ALTER TABLE "owners" ALTER COLUMN "upload_token_required_for_public_repos" SET NOT NULL;
COMMIT;
"""