-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: create test_analytics app and database (#474)
* feat: create test_analytics app and database - creates a new test_analytics django app - modifies the db_settings to declare a new test analytics database - modifies the db router to route the models from the new django app to the new database * test: fix tests * remove logs * fix dummy_settings * create migration for test_analytics app
- Loading branch information
1 parent
d1762e3
commit 6c6d5a1
Showing
8 changed files
with
187 additions
and
34 deletions.
There are no files selected for viewing
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
Empty file.
44 changes: 44 additions & 0 deletions
44
shared/django_apps/test_analytics/migrations/0001_initial.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,44 @@ | ||
# Generated by Django 4.2.16 on 2025-01-17 22:07 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
initial = True | ||
|
||
dependencies = [] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name="Flake", | ||
fields=[ | ||
("id", models.BigAutoField(primary_key=True, serialize=False)), | ||
("repoid", models.IntegerField()), | ||
("test_id", models.BinaryField()), | ||
("recent_passes_count", models.IntegerField()), | ||
("count", models.IntegerField()), | ||
("fail_count", models.IntegerField()), | ||
("start_date", models.DateTimeField()), | ||
("end_date", models.DateTimeField(null=True)), | ||
], | ||
options={ | ||
"db_table": "test_analytics_flake", | ||
"indexes": [ | ||
models.Index( | ||
fields=["repoid"], name="test_analyt_repoid_fcd881_idx" | ||
), | ||
models.Index( | ||
fields=["test_id"], name="test_analyt_test_id_f504a1_idx" | ||
), | ||
models.Index( | ||
fields=["repoid", "test_id"], | ||
name="test_analyt_repoid_0690c3_idx", | ||
), | ||
models.Index( | ||
fields=["repoid", "end_date"], | ||
name="test_analyt_repoid_9e2402_idx", | ||
), | ||
], | ||
}, | ||
), | ||
] |
Empty file.
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,28 @@ | ||
from django.db import models | ||
|
||
# Added to avoid 'doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS' error\ | ||
# Needs to be called the same as the API app | ||
TEST_ANALYTICS_APP_LABEL = "test_analytics" | ||
|
||
|
||
class Flake(models.Model): | ||
id = models.BigAutoField(primary_key=True) | ||
|
||
repoid = models.IntegerField() | ||
test_id = models.BinaryField() | ||
|
||
recent_passes_count = models.IntegerField() | ||
count = models.IntegerField() | ||
fail_count = models.IntegerField() | ||
start_date = models.DateTimeField() | ||
end_date = models.DateTimeField(null=True) | ||
|
||
class Meta: | ||
app_label = TEST_ANALYTICS_APP_LABEL | ||
db_table = "test_analytics_flake" | ||
indexes = [ | ||
models.Index(fields=["repoid"]), | ||
models.Index(fields=["test_id"]), | ||
models.Index(fields=["repoid", "test_id"]), | ||
models.Index(fields=["repoid", "end_date"]), | ||
] |
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