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

Spike reporting db #1316

Closed
wants to merge 23 commits into from
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ ENV/
env.bak/
docker-compose.override.yml
settings/envs/docker.override.env
.envrc

# Spyder project settings
.spyderproject
Expand Down
Empty file added open_data/__init__.py
Empty file.
1 change: 1 addition & 0 deletions open_data/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Register your models here.
7 changes: 7 additions & 0 deletions open_data/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from common.app_config import CommonConfig

APP_LABEL = "open_data"


class OpenDataConfig(CommonConfig):
name = APP_LABEL
Empty file.
22 changes: 22 additions & 0 deletions open_data/management/commands/refresh_reporting.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import logging

from django.core.management.base import BaseCommand

from open_data.tasks import update_all_tables

logger = logging.getLogger(__name__)


class Command(BaseCommand):
help = (
"It deletes all the data in the reporting tables, and copy a fresh set of data"
"from the tracked tables in the database."
)

def handle(self, *args, **options):
logger.info(f"Starting the update of all the tables in the database")
update_all_tables(True)

self.stdout.write(
self.style.SUCCESS("Successfully updated the reporting tables."),
)
15 changes: 15 additions & 0 deletions open_data/migrations/0001_create_schema.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Generated by Django 4.2.15 on 2024-10-30 11:07

from django.db import migrations


class Migration(migrations.Migration):

dependencies = []

operations = [
migrations.RunSQL(
sql=[("CREATE SCHEMA reporting;")],
reverse_sql=[("DROP SCHEMA reporting;")],
),
]
Loading
Loading