-
Notifications
You must be signed in to change notification settings - Fork 32
Open
Description
There are several places that reference the fastpath table definition, both in docs and code, and there are some that are behind the current version. This issue will try to list them:
- In the docs: https://docs.ooni.org/backend/database/#fastpath-table
- The migration script:
backend/fastpath/database_upgrade_schema.py
Lines 143 to 161 in 4fe09eb
CREATE TABLE public.fastpath ( measurement_uid text NOT NULL, report_id text NOT NULL, input text, probe_cc character(2) NOT NULL, probe_asn integer NOT NULL, test_name public.ootest, test_start_time timestamp without time zone NOT NULL, measurement_start_time timestamp without time zone, filename text, scores json NOT NULL, platform text, anomaly boolean, confirmed boolean, msm_failure boolean, domain text, software_name text, software_version text ); - In several tests we have files used to create the database: https://github.com/ooni/backend/blob/4fe09ebf9d158bcd655d92ef88967717666c0863/ooniapi/services/oonimeasurements/tests/migrations/0_clickhouse_init_tables.sql
- With these ones we have 2 choices:
- We let them out of sync, expressing that "this is the version this code was made for", and we update them manually when we update each component individually. The downside being that tests wont catch errors if we change the database schema for a feature in another component
- We create a
commondirectory with a source-of-truth database schema for tests that is reused by other components. This way tests would catch errors sooner
- With these ones we have 2 choices:
- fastpath.db:
backend/fastpath/fastpath/db.py
Line 46 in 4fe09eb
def _click_create_table_fastpath() -> None: - schema.sql in devops: https://github.com/ooni/devops/blob/a980b13676277b9ad4c173d80f88cdb96c7fd4ea/scripts/cluster-migration/schema.sql#L19