-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: allow config for multi-apps (#421)
These changes introduce `OwnerInstallationNameToUseForTask` model. This model allows an `Owner` to configure a `installation_name` to be used for a given `task_name`. This can only be configured manually for now. That is on purpose as we want to test these changes first. context: codecov/engineering-team#1146 >⚠️ **These changes include a migration** > > Migration creates table for `OwnerInstallationNameToUseForTask`. > Should not be disruptive when deployed. Co-authored-by: Trent Schmidt <trent@codecov.io>
- Loading branch information
1 parent
ab757ca
commit bd7cf76
Showing
6 changed files
with
147 additions
and
0 deletions.
There are no files selected for viewing
63 changes: 63 additions & 0 deletions
63
codecov_auth/migrations/0053_ownerinstallationnametousefortask_and_more.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# Generated by Django 4.2.7 on 2024-02-21 16:03 | ||
|
||
import uuid | ||
|
||
import django.db.models.deletion | ||
import django_prometheus.models | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("codecov_auth", "0052_githubappinstallation_app_id_and_more"), | ||
] | ||
|
||
# BEGIN; | ||
# -- | ||
# -- Create model OwnerInstallationNameToUseForTask | ||
# -- | ||
# CREATE TABLE "codecov_auth_ownerinstallationnametousefortask" ("id" bigint NOT NULL PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY, "external_id" uuid NOT NULL, "created_at" timestamp with time zone NOT NULL, "updated_at" timestamp with time zone NOT NULL, "installation_name" text NOT NULL, "task_name" text NOT NULL, "owner_id" integer NOT NULL); | ||
# -- | ||
# -- Create constraint single_task_name_per_owner on model ownerinstallationnametousefortask | ||
# -- | ||
# CREATE UNIQUE INDEX "single_task_name_per_owner" ON "codecov_auth_ownerinstallationnametousefortask" ("owner_id", "task_name"); | ||
# ALTER TABLE "codecov_auth_ownerinstallationnametousefortask" ADD CONSTRAINT "codecov_auth_ownerin_owner_id_8bf0ce9b_fk_owners_ow" FOREIGN KEY ("owner_id") REFERENCES "owners" ("ownerid") DEFERRABLE INITIALLY DEFERRED; | ||
# CREATE INDEX "codecov_auth_ownerinstalla_owner_id_8bf0ce9b" ON "codecov_auth_ownerinstallationnametousefortask" ("owner_id"); | ||
# COMMIT; | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name="OwnerInstallationNameToUseForTask", | ||
fields=[ | ||
("id", models.BigAutoField(primary_key=True, serialize=False)), | ||
("external_id", models.UUIDField(default=uuid.uuid4, editable=False)), | ||
("created_at", models.DateTimeField(auto_now_add=True)), | ||
("updated_at", models.DateTimeField(auto_now=True)), | ||
("installation_name", models.TextField()), | ||
("task_name", models.TextField()), | ||
( | ||
"owner", | ||
models.ForeignKey( | ||
on_delete=django.db.models.deletion.CASCADE, | ||
related_name="installation_name_to_use_for_tasks", | ||
to="codecov_auth.owner", | ||
), | ||
), | ||
], | ||
bases=( | ||
django_prometheus.models.ExportModelOperationsMixin( | ||
"codecov_auth.github_app_installation" | ||
), | ||
models.Model, | ||
), | ||
), | ||
migrations.AddConstraint( | ||
model_name="ownerinstallationnametousefortask", | ||
constraint=models.UniqueConstraint( | ||
models.F("owner_id"), | ||
models.F("task_name"), | ||
name="single_task_name_per_owner", | ||
), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters