Skip to content
This repository was archived by the owner on Jun 13, 2025. It is now read-only.

Commit 7ca85f3

Browse files
committed
add commands for seeding DB
1 parent 4d1167b commit 7ca85f3

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

core/management/commands/insert_data_to_db_from_csv.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,13 @@ def handle(self, *args, **kwargs):
5151
)
5252
continue
5353

54-
# Use update_or_create
5554
Model.objects.update_or_create(
5655
defaults=model_data,
5756
# Specify the fields to identify the record
5857
# For example, if 'id' is the unique field:
5958
id=row.get("id"),
6059
)
61-
self.stdout.write(self.style.SUCCESS(f"Processed row: {row}"))
60+
self.stdout.write(self.style.SUCCESS(f"Inserted row: {row}"))
6261

6362
self.stdout.write(
6463
self.style.SUCCESS(

dev.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# starts the development server using gunicorn
44
# NEVER run production with the --reload option command
5-
echo "Starting gunicorn in dev mode"
5+
echo "API: Starting gunicorn in dev mode"
66

77
_start_gunicorn() {
88
if [ -n "$PROMETHEUS_MULTIPROC_DIR" ]; then
@@ -19,6 +19,8 @@ _start_gunicorn() {
1919
python manage.py migrate
2020
python manage.py migrate --database "timeseries" timeseries
2121
python manage.py pgpartition --yes --skip-delete
22+
python manage.py insert_data_to_db_from_csv core/management/commands/codecovTiers-Jan25.csv --model tiers
23+
python manage.py insert_data_to_db_from_csv core/management/commands/codecovPlans-Jan25.csv --model plans
2224
fi
2325
if [[ "$DEBUGPY" ]]; then
2426
pip install debugpy

0 commit comments

Comments
 (0)