Repository navigation
refactor(db)!: replace the conditions migration history with one baseline and fix the schema - #455
Merged
Merged
Conversation
…line The 107 migrations up to 0106 become two files: a baseline generated by drizzle-kit from the schema code, and a custom migration with what drizzle-kit cannot express (the partitioned observation table and its index, the observation_latest storage settings, the functions, the four federation capture triggers, the federation journal's first epoch and, until the schema code declares it, the geonet coverage CHECK). Applied as a role holding only CREATE on the database, it gives the same conditions schema as the old chain on PostgreSQL 16 and 18, apart from physical column order. Data fixes the old migrations applied to existing rows are not carried over. A test limits the custom file to the statement kinds drizzle-kit cannot express, and a fresh-migrate test checks the functions, triggers and storage settings. Tests that replayed old migration files are removed. pnpm check:migrations fails when the schema code and the migrations disagree, and CI runs it. BREAKING CHANGE: a database created by an earlier build is not upgraded and has to be recreated. The old history is in Git up to 09e880b.
drizzle-kit exits 0 and writes nothing when it refuses a prompt without a terminal and when the schema code fails to load, so an exit code and an unchanged folder passed real drift. The gate now runs as a script that requires "Everything's fine" and "No schema changes, nothing to migrate", fails on any error or TTY line, a nonzero exit, a timeout, or a changed migrations folder. The docs also name the temporary geonet CHECK in the custom file and no longer treat the baseline's foreign-key ALTERs as a sign of a non-empty folder.
…migration A dollar sign in a comment can pair with another and hide a statement between them, and the seed row matched any multi-row insert. Comments with a dollar sign are refused, the seed row must be the one exact statement and appear once, and committed cases pin what the check must refuse and accept. A test title now says what it checks: a second migrate keeps a later deployed function.
…ngest The migrator records applied migrations in conditions.__drizzle_migrations instead of drizzle.__drizzle_migrations_oc, so the ingest role needs to own only conditions, the history never mixes with another Drizzle project's in a shared database, and dropping conditions drops its history with it. Only the ingest service migrates. The contributions and federation services wait at boot with waitForSchemaVersion until the history reaches the latest journal entry their build ships, or a later one, and stop with what they expected and found after OPENCONDITIONS_SCHEMA_WAIT_TIMEOUT_MS (default five minutes). Image qualification applies the source's migrations to the fixture database for those two images, as they no longer migrate it themselves.
The OAuth grant tokens, the token issuer's private keys and the federation instance keys were stored in clear, so every database dump and backup held them. They are now sealed with AES-256-GCM under OPENCONDITIONS_SECRETS_KEY (64 hex characters, read from OPENCONDITIONS_SECRETS_KEY_FILE under OpenMapX), each value bound to its table, column and row. The ciphertext, IV and tag columns replace the plaintext ones, with CHECKs on the IV and tag lengths. Ingest, its feed-auth command, the contributions API and an enabled federation service refuse to start without the key, with a malformed one, or with one that cannot decrypt a stored secret, naming the table and row. Token redemption and the published issuer key list read only public keys. The manifests declare the key as a vault secret, and the README says how to generate and keep it and what losing it costs.
… key The container qualification starts each image with OPENCONDITIONS_SECRETS_KEY, which the services now refuse to start without. The context check pins the reviewed script's digest, so it follows that one-line change.
…vice sealed After migrating, the ingest service seals a fixed value with its secrets key in a new one-row table, conditions.secrets_key_check, once. The contributions API and an enabled federation service wait for that row after the schema version and refuse to start when their key does not open it; the feed-auth command checks it too. The ingest service opens its stored grants before it seals the row, so a wrong key never seals it. The contributions role is granted SELECT on the new table. Only the ingest service's key field says how to generate the key; the heavy-feeds ingest, contributions and federation fields say to copy it, and no field claims the key never reaches the database. The container qualification seals the check row with the image's own code before the contributions API starts, and the context check pins the changed script. The federation actor document reads public keys only, the federation settings narrow on enabled instead of asserting the key, the ingest start is a tested function, and the env-or-file credential reader lives once, in core.
The OpenConditions tables never hold the key, but under OpenMapX its vault keeps it in the same database, encrypted with OpenMapX's own secrets key: a backup is safe for these secrets only while that key file stays out of it, and both keys belong in the recovery set. The key is generated once for the ingest service and copied to the others, the quick start reuses one key file, and starting over after a lost or compromised key lists every step and consequence.
The reporter table loses osm_uid, email_lookup_hmac and flagged_count, and sub_claim loses subject_component_key, which nothing wrote or read. The vote uniqueness becomes sub_claim_subject_class_subject_id_key_id_claim_type_key. The OSM-auth verifier result no longer carries an account id, since there is nowhere to keep one. sub_claim, report_refusal and token_quota reference reporter ON DELETE CASCADE and report_evidence ON DELETE SET NULL, so deleting a reporter removes its votes, refusals and quotas and keeps its evidence keyless. Peer deliveries and external resolutions already write a NULL actor. Corroboration credits no key when the merged report's reporter is gone. spent_token gains expires_at, set at redemption from the not_after of the issuer key the token names (now for a token that names no stored key), so expired rows can be pruned. The retention sweep's expiry and activity columns are indexed.
…g in the sweep The records sweep now deletes a reporter whose last_active_at and entitlement_expires_at both lie more than 12 months back (both columns are NOT NULL), token quotas of an ended UTC day, spent tokens past their expiry and federation erasure facts past theirs. The reporter's foreign keys take its votes, refusals and quotas with it and clear its key from its evidence. Each delete runs in batches of 500 rows per statement and skips rows another transaction holds, so the sweep holds no long lock and never waits on an enrolment; a batch that meets a lock past lock_timeout counts as busy.
A BEFORE DELETE trigger on conditions.reporter removes provenance.reporter from the reporter's latest crowd readings, crowd situations, their revisions and their federation journal entries, in the deleting transaction. The sweep, a delete by hand and any later path therefore erase the key alike. The whole reporter object goes, since a reporter without its key is not a valid record and a record without one is. The rows are found through the reporter's evidence, which still names the key before the delete's SET NULL runs, then through the crowd record, primary-key and journal indexes; no index on the readings is added, so flow updates stay heap-only. The function pins its search path and runs as the deleting role: only the ingest service, the owner, deletes reporters.
…kens a day longer A reporter batch now takes the crowd's advisory lock, then its reporter rows FOR UPDATE SKIP LOCKED, then deletes them: the order landings take them in, so the two cannot deadlock and a landing cannot write a key back while the delete strips it. A lock held past lock_timeout leaves the batch to the next sweep. Spent tokens are deleted a day after their expiry instead of at it, so a contributions service whose clock runs behind the ingest service's cannot redeem a token whose row is already gone. The sweep's doc comment no longer says every delete runs under a source's lock.
…weep segment_observation and segment_profile lose their segment_id indexes, which the primary keys already serve, and segment_speed loses its level-of-service index, which nothing reads. The crowd evidence index keys on evidence_state alone, as origin is constant inside it. feature and offer get the expiry and tombstone indexes the five-minute sweep looks up.
…for closed value sets The five bigserial columns become identity columns generated by default; their sequences keep their names, so the contributions grants are unchanged. jma_budget.day is a date, segment_observation.confidence becomes confidence_score (it is a number, unlike segment_speed.confidence), and smn_cap_message.retrieval loses a default that could only mislabel a new row. Level of service, segment speed confidence, binding status and direction, subscription status and erasure reason each get a CHECK of their values.
…umns Primary keys are <table>_pkey, uniques <table>_<columns>_key, foreign keys <table>_<column>_fkey, indexes <table>_<columns>_idx and checks <table>_<what>_check. Foreign keys move from .references() to named foreignKey() and composite primary keys get explicit names. The geonet coverage CHECK is declared in the schema code as geonet_coverage_order_check, so the custom migration no longer carries it and its statement-kind test allows no CHECK at all.
observation, observation_latest and observation_rollup_hourly put their 8-byte columns first, then the narrower fixed-width ones and the variable-length ones last, so no row pays alignment padding between them. The observation primary key is unchanged, and every writer and reader of these tables names its columns.
… in the catalog The schema conventions tests read the catalog: every constraint and index named after its table and columns or listed as named for its purpose, no serial default and identity on the five ids, a CHECK naming every value of each closed set, fixed-width columns first in the observation tables, no index a unique constraint already serves, every foreign key column indexed, the records sweep's indexes, and the jma_budget, segment_observation and smn_cap_message column types.
The series read and the deletion of a re-homed crowd series' history name the series' retention_days, which the history is partitioned by, so each reads one class's partitions instead of all. A reading stored under a class the property no longer keeps is past the series' retention: it is not read, and its own partition's retention drops it.
…can leave a reporter's key The release note's compatibility section lists how the schema differs from the old migration chain, by category, instead of claiming it equals it. The crowd limitations say that a hand delete within about 37 days of a situation purge can leave journal entries with the key until the daily journal prune, which the sweep never hits.
…ts class The series read matched readings on the series' current retention class, so after a property's retention changed it hid every reading written under the earlier class, even inside both retentions. It now reads every class and serves a reading while it is inside the property's current raw retention; each reading's own class still drops it with its partition. The supersession of a change-only reading also continues across a class change.
… class Deleting a re-homed crowd series' history matched only its current retention class and skipped a series without one, which left readings under any other class behind, those of the keep-everything class for good. It deletes by series alone again.
…ery one record_binding.status now has a CHECK of BindingStatus, so a status the metrics reader does not know cannot be stored. STATUS_KEYS is typed over every current status, which the compiler keeps complete, and the unknownStatus counter that could no longer count anything is gone from the reader, its test and the binding docs.
…eed none The ids it inserts are identity columns, whose default takes the next value with the table's INSERT privilege alone, so the USAGE grants on their four sequences widened the role's exact privileges for nothing. The contributions flows test still runs every insert with the smaller set.
…se-named indexes The release note listed the GeoNet coverage CHECK among the new ones, though the old schema had it under another name, and its naming bullet left out the indexes named for their purpose. A segment speed comment names the renamed confidence_score column.
This file contains hidden or 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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed and why
No OpenConditions database has to stay upgradeable yet, so this is the last cheap moment to fix the schema before OpenMapX's first production install freezes it. This PR replaces the 107-file migration history with one generated baseline (
0000_baseline.sql) plus one custom file (0001_database_objects.sql) for what Drizzle cannot express, and fixes what the pre-install schema review found. The OpenMapX side merged as OpenMapX/openmapx#1079.One baseline, and a drift gate. The migrations are regenerated from the schema code. A new check (
scripts/check-drizzle-drift.ts, in the existing CI job andverify:full) passes only when drizzle-kit reports no drift. drizzle-kit 0.31 exits 0 without writing when it would need a prompt, so an exit code alone proves nothing. A test limits the custom file to the statement kinds Drizzle cannot express. Until the first release containing the baseline is installed, schema changes regenerate it. After that they add ordinary incremental migrations (docs/database-migrations.md). The last commit with the old history is09e880bd.Migration ownership.
conditions.__drizzle_migrations, and only the ingest processes migrate.OPENCONDITIONS_SCHEMA_WAIT_TIMEOUT_MS, default 5 minutes).search_path = conditions, extensionson the roles.Grants as a contract.
conditions.grant_consumer_roles()(SECURITY INVOKER, pinned search path, no PUBLIC execute) grants exactly what is used:openmapx_tiles_ownergets the four tables and three functionssegment_flowneeds, so credentials and crowd data stay unreadable to every OpenMapX role;openconditions_contributionsgets the 53 table privileges its queries use.Ingest calls it after every migrate, so a role created later or restored from a backup gets its grants at the next ingest start.
Secrets encrypted at rest.
OPENCONDITIONS_SECRETS_KEYsecret. The first ingest process seals a check row with it, and every other service refuses to start with a different key.Crowd data minimisation.
reporter.osm_uid,email_lookup_hmac,flagged_countandsub_claim.subject_component_keyare dropped.BEFORE DELETEtrigger strips its key from crowd readings, situations, revisions and outbox snapshots on every delete path.Schema hygiene.
bigserial.Smaller fixes.
openlrschema instead ofconditions.Related work
extensionsschema and created the tile roles this contract grants to.Verification and limits
0000_baseline.sqlbyte for byte, with an equal snapshot apart fromid/prevId. The drift gate and the statement-kind test pass.pnpm verify:fullat the head exits 0: 9778 tests passed, including the container-starting files and the packed OCPI consumer check;ruffclean;pnpm check-credentialsandpnpm check:release-informationpass.a7e2f9a), run on a production-entrypoint PostGIS with PostGIS inextensions, OpenMapX's roles and its API migrations applied:openconditions_ingest, recording two history rows inconditions, applying exactly the contract grants and sealing the key check;openmapx_tiles, served asegment_flowtile for a synthetic segment as a 776-byte MVT;openmapx_tilesis refused every direct read ofconditions.postgresandnode:crypto, which the image ships; the first version imported bundled core code and failed withERR_MODULE_NOT_FOUNDinside a real image. A contributions-api image built from this branch (arm64) sealed the row and came up healthy. The full amd64qualify --imagerun with Trivy happens for the first time in this PR'sbuild-imagesjob. The script's SHA-256 pin inscripts/check-docker-contexts.mjschanged deliberately; no Dockerfile, workflow or build context changed.Release and upgrade impact
conditionsschema or the database first, and also drop the olddrizzle.__drizzle_migrations_octable.OPENCONDITIONS_SECRETS_KEY(64 hex characters,openssl rand -hex 32) is required on ingest, ingest-heavy, contributions-api and federation.openconditions_ingest, which ownsconditionsand keepsCREATEon the database at every start. Federation and the heavy-feeds process also connect as this role.openconditions_contributions.search_path = conditions, extensions, before ingest first starts.openlr./feeds/statusno longer reportsunknownStatus;docs/release-notes/database-baseline.mdlists every operator step and schema difference. No Changeset: the only public package,@openconditions/ocpi, is untouched.Deferred, with reasons:
COLLATE "C"id columns: drizzle-orm cannot declare a column collation.block_listwhile the block stands, by design.Merge as a squash: some intermediate commits are not self-consistent on their own.
Schema differences against the old migration chain
Both schemas were built fresh on PostgreSQL 18.6 with PostGIS 3.6 (
ghcr.io/baosystems/postgis:18-3.6, the repository'spg18test profile image), PostGIS created by the superuser, each migrated as the non-superuseropenconditions_ingestholding onlyCREATEon its database.openconditions_contributionsandopenmapx_tiles_ownerexisted before either migrate, so the grants show. The chain is the 107 migrations of09e880bdapplied the way that commit'srunMigrations()applied them; the baseline is this branch's builtrunMigrations()at8df4e268. The fresh chain dump (pg_dump --schema-only -O -x -n conditions -n drizzle) is byte-identical to B0's chain dump apart from pg_dump's random\restricttoken. The comparison below is over the system catalogs (tables, columns, column order, constraints, indexes, functions, triggers, storage parameters, grants), with constraints and indexes matched by their definition, so a rename is reported as a rename and not as a drop and an add.Counts, chain → baseline: tables 67 → 69, columns 654 → 667, constraints 137 → 157, indexes 148 → 153, functions 24 → 26, triggers 4 → 5,
federation_journalseed rows 1 → 1. The 24 functions of the chain are unchanged in the baseline (pg_get_functiondefhashes equal), among themconditions.segment_flow. Every difference traces to a commit on this branch:Migration history and ownership
drizzle.__drizzle_migrations_octoconditions.__drizzle_migrations(drizzle's own table shape:id serialwith__drizzle_migrations_pkey,hash,created_at), and only the ingest service migrates.3ecb3f720000_baseline,0001_database_objects) instead of 107.076892bdGrants
conditions.grant_consumer_roles()(SECURITY INVOKER,search_path = pg_catalog, pg_temp,EXECUTErevoked fromPUBLIC), called byrunMigrations()after every migrate.8dddf975,bada9d1aopenmapx_tiles_owner:USAGEonconditions;SELECTonroad_segment,segment_speed,source,public_license_policy;EXECUTEonsegment_flow,flow_public_licenses,flow_osm_credit(8 grants; the chain granted none).8dddf975openconditions_contributions:USAGEonconditionsand 53 table privileges (SELECTon 27 tables including__drizzle_migrationsandsecrets_key_check,INSERTon 15,UPDATEon 6,DELETEon 5), no sequence privilege (the chain granted none).8dddf975,dfebb164(secrets_key_check),b8e18bcf(no sequence grants)Secrets
oauth_grant.access_token,oauth_grant.refresh_token,issuer_key.private_keyandfederation_instance_key.private_keyare replaced by<column>_ciphertext,<column>_ivand<column>_tag(bytea, nullability as before), each trio with a CHECK that the three are set together, the IV is 12 bytes and the tag 16 (<table>_<column>_check).d0deebf0secrets_key_check(id smallint DEFAULT 1withsecrets_key_check_id_check (id = 1)andsecrets_key_check_pkey,value_ciphertext/value_iv/value_tagwithsecrets_key_check_value_check,created_at timestamptz DEFAULT now()).dfebb164Crowd data
reporter.osm_uid,reporter.email_lookup_hmac,reporter.flagged_count,sub_claim.subject_component_key; the unique keyuq_sub_claim_subject_key_typeon five columns becomessub_claim_subject_class_subject_id_key_id_claim_type_keyon four.9c6a5888reporter(key_id):report_evidence_actor_key_id_fkey(ON DELETE SET NULL),report_refusal_actor_key_id_fkey,sub_claim_key_id_fkey,token_quota_key_id_fkey(ON DELETE CASCADE).9c6a5888spent_token.expires_at timestamptz NOT NULL; the indexidx_spent_token_spent_atis replaced byspent_token_expires_at_idx. New sweep indexesreporter_last_active_at_idxandfederation_tombstone_expires_at_idx.9c6a5888(the sweep that uses them is67a6704a, the extra day on spent tokens9cb3774b, with no schema change)conditions.reporter_strip_key()and itsBEFORE DELETEtriggerreporter_strip_keyonreporter.2ca20fd5Ids and types
GENERATED BY DEFAULT AS IDENTITY, sequence names kept) instead ofbigserialdefaults:federation_outbox.seq,observation_latest.series_id,report_evidence.id,report_refusal.id,source_poll_attempt.id.c887416fjma_budget.dayisdateinstead oftext.c887416fsegment_observation.confidenceis renamedconfidence_score(same type).c887416fsmn_cap_message.retrievalloses its default'{"legacy": true}'::jsonb.c887416fCHECKs for closed value sets
federation_subscription_status_check,federation_tombstone_reason_check,record_binding_direction_mode_check,record_binding_status_check,segment_observation_los_check,segment_speed_confidence_check,segment_speed_los_check.c887416fIndexes
idx_segment_observation_segment,idx_segment_profile_segment,idx_segment_speed_los.b423f4a9idx_situation_crowd_evidence (origin, evidence_state) WHERE origin = 'crowd'becomessituation_evidence_state_crowd_idx (evidence_state) WHERE origin = 'crowd'.b423f4a9feature_expires_at_idxandoffer_expires_at_idx(expires_at WHERE tombstoned_at IS NULL),feature_tombstoned_at_idxandoffer_tombstoned_at_idx(tombstoned_at WHERE tombstoned_at IS NOT NULL).b423f4a9Names
<table>_pkey,<table>_<columns>_key,<table>_<column>_fkey,<table>_<columns>_idxand<table>_<what>_check, or a purpose name for partial, collated, expression and over-long indexes (<table>_id_bytes_idx,<table>_id_rights_revoked_idx,observation_latest_value_money_fuel_price_idx,feature_external_ids_idx,observation_latest_series_key, and others). By kind: 28 primary keys, 62 CHECKs (the GeoNet coverage CHECK, written in the chain's last custom migration asgeonet_coverage_order, is nowgeonet_coverage_order_checkin the schema code), 7 foreign keys, 1 unique constraint. The two GIN indexes withfastupdate=offkeep that parameter under their new names.4d8471b1(also the GeoNet CHECK's move from the custom migration into the schema code)Physical column order
contributor_receipt,feature,feature_canonical,federation_instance_key,federation_outbox,federation_peer_key,federation_subscription,federation_tombstone,geonet_coverage,issuer_key,oauth_grant,observation,observation_latest,observation_rollup_daily,observation_rollup_hourly,offer,osm_road,report_evidence,reporter,segment_observation,segment_profile,segment_speed,sensor_baseline,sensor_segment,situation,smn_cap_message,source,source_status,spent_token,sub_claim.076892bdobservation,observation_latestandobservation_rollup_hourlystore their fixed-width columns first.24745e67issuer_key,oauth_grant,federation_instance_key,reporter,spent_token,sub_claim,segment_observation: columns added, dropped or renamed above.d0deebf0,9c6a5888,c887416f076892bdUnchanged
federation_capturetriggers, the partitionedobservationtable's partitioning, theobservation_lateststorage parameters (toast_tuple_target = 1200,fillfactor = 50, the autovacuum scale factors) and column storage modes, and thefederation_journalseed row.conditions.osm_nodes/osm_lines(created at graph build time, never by a migration) to the schemaopenlr, with an identityline_id.43fcceb5,8df4e268(docstring)Every rename and the column orders
binding_queue:binding_queue_record_class_record_id_effect_id_pk→binding_queue_pkeyfeature:feature_tombstone_complete→feature_tombstone_checkfeature:feature_tombstone_reason_enum→feature_tombstone_reason_checkfeature:feature_access_mode_enum→feature_access_mode_checkfeature:feature_lifecycle_enum→feature_lifecycle_checkfeature:feature_origin_enum→feature_origin_checkfeature:feature_privacy_class_enum→feature_privacy_class_checkfeature:feature_revision_positive→feature_revision_checkfeature:feature_temporality_enum→feature_temporality_checkfeature_component:feature_component_lifecycle_enum→feature_component_lifecycle_checkfeature_component:feature_component_feature_id_feature_id_fk→feature_component_feature_id_fkeyfeature_component:feature_component_feature_id_key_pk→feature_component_pkeyfeature_link:feature_link_ordered→feature_link_order_checkfeature_link:feature_link_method_enum→feature_link_method_checkfeature_link:feature_link_status_enum→feature_link_status_checkfeature_link:feature_link_a_id_b_id_pk→feature_link_pkeyfeature_revision:feature_revision_feature_id_feature_id_fk→feature_revision_feature_id_fkeyfeature_revision:feature_revision_feature_id_revision_pk→feature_revision_pkeyfederation_journal:federation_journal_single_row→federation_journal_singleton_checkfederation_lapsed_copy:federation_lapsed_copy_record_class_record_id_pk→federation_lapsed_copy_pkeyfederation_outbox:federation_outbox_delete_shape→federation_outbox_delete_shape_checkfederation_outbox:federation_outbox_operation_enum→federation_outbox_operation_checkfederation_outbox:federation_outbox_record_class_enum→federation_outbox_record_class_checkfederation_peer_key:federation_peer_key_peer_instance_id_key_id_pk→federation_peer_key_pkeyfederation_source_receipt:federation_source_receipt_peer_instance_id_source_id_pk→federation_source_receipt_pkeyfederation_subscription:federation_subscription_delivery_mode_enum→federation_subscription_delivery_mode_checkfederation_tombstone:federation_tombstone_canonical_id_peer_instance_id_pk→federation_tombstone_pkeygeonet_coverage:geonet_coverage_order→geonet_coverage_order_checkjma_budget:jma_budget_nonnegative→jma_budget_nonnegative_checkjma_budget:jma_budget_egress_day_pk→jma_budget_pkeynsw_rfs_clock:nsw_rfs_clock_source_id_incident_id_pk→nsw_rfs_clock_pkeyobservation:observation_retention_days_nonneg→observation_retention_days_checkobservation:observation_pk→observation_pkeyobservation_latest:observation_latest_evidence_state_enum→observation_latest_evidence_state_checkobservation_latest:observation_latest_access_mode_enum→observation_latest_access_mode_checkobservation_latest:observation_latest_series→observation_latest_series_keyobservation_revision:observation_revision_source_id_feature_id_property_pk→observation_revision_pkeyobservation_rollup_daily:observation_rollup_daily_series_fk→observation_rollup_daily_series_id_fkeyobservation_rollup_daily:observation_rollup_daily_series_id_day_utc_pk→observation_rollup_daily_pkeyobservation_rollup_hourly:observation_rollup_hourly_series_fk→observation_rollup_hourly_series_id_fkeyobservation_rollup_hourly:observation_rollup_hourly_series_id_hour_utc_pk→observation_rollup_hourly_pkeyoffer:offer_tombstone_complete→offer_tombstone_checkoffer:offer_tombstone_reason_enum→offer_tombstone_reason_checkoffer:offer_access_mode_enum→offer_access_mode_checkoffer:offer_origin_enum→offer_origin_checkoffer:offer_privacy_class_enum→offer_privacy_class_checkoffer:offer_revision_positive→offer_revision_checkoffer:offer_subject_class_enum→offer_subject_class_checkoffer:offer_temporality_enum→offer_temporality_checkoffer_revision:offer_revision_offer_id_offer_id_fk→offer_revision_offer_id_fkeyoffer_revision:offer_revision_offer_id_revision_pk→offer_revision_pkeyon_demand_fetch:on_demand_fetch_status_enum→on_demand_fetch_status_checkon_demand_fetch:on_demand_fetch_source_id_cell_pk→on_demand_fetch_pkeyraw_payload:raw_payload_tier_enum→raw_payload_tier_checkraw_payload:raw_payload_pk→raw_payload_pkeyrecord_binding:record_binding_record_class_enum→record_binding_record_class_checkrecord_binding:record_binding_record_class_record_id_effect_id_pk→record_binding_pkeyrecord_relation:record_relation_from_class_enum→record_relation_from_class_checkrecord_relation:record_relation_relation_enum→record_relation_relation_checkrecord_relation:record_relation_to_class_enum→record_relation_to_class_checkrecord_relation:record_relation_pk→record_relation_pkeyrecord_segment:record_segment_record_class_record_id_effect_id_seq_pk→record_segment_pkeyreport_evidence:report_evidence_kind_enum→report_evidence_evidence_kind_checkreport_evidence:report_evidence_record_class_enum→report_evidence_record_class_checkreporter:reporter_reputation_alpha_positive→reporter_reputation_alpha_checkreporter:reporter_reputation_beta_positive→reporter_reputation_beta_checkreporter:reporter_status_enum→reporter_status_checkroad_graph_state:road_graph_state_singleton→road_graph_state_singleton_checksegment_observation:segment_observation_segment_id_source_pk→segment_observation_pkeysegment_profile:segment_profile_segment_id_dow_tod_hour_pk→segment_profile_pkeysensor_baseline:sensor_baseline_subject_key_dow_bucket_tod_bucket_method_pk→sensor_baseline_pkeysituation:situation_evidence_state_enum→situation_evidence_state_checksituation:situation_severity_level_range→situation_severity_level_checksituation:situation_tombstone_complete→situation_tombstone_checksituation:situation_tombstone_reason_enum→situation_tombstone_reason_checksituation:situation_access_mode_enum→situation_access_mode_checksituation:situation_certainty_enum→situation_certainty_checksituation:situation_origin_enum→situation_origin_checksituation:situation_privacy_class_enum→situation_privacy_class_checksituation:situation_revision_positive→situation_revision_checksituation:situation_severity_enum→situation_severity_checksituation:situation_temporality_enum→situation_temporality_checksituation:situation_validity_status_enum→situation_validity_status_checksituation_effect:situation_effect_applicability_enum→situation_effect_applicability_kind_checksituation_effect:situation_effect_compliance_enum→situation_effect_compliance_checksituation_effect:situation_effect_normalization_enum→situation_effect_normalization_checksituation_effect:situation_effect_situation_id_situation_id_fk→situation_effect_situation_id_fkeysituation_effect:situation_effect_situation_id_effect_id_pk→situation_effect_pkeysituation_revision:situation_revision_situation_id_situation_id_fk→situation_revision_situation_id_fkeysituation_revision:situation_revision_situation_id_revision_pk→situation_revision_pkeysmn_cap_message:smn_cap_message_source_id_variant_pk→smn_cap_message_pkeysource:source_access_mode_enum→source_access_mode_checksource:source_tier_enum→source_tier_checksource_shrink:source_shrink_scope_enum→source_shrink_scope_checksource_shrink:source_shrink_source_id_scope_pk→source_shrink_pkeysub_claim:sub_claim_claim_type_enum→sub_claim_claim_type_checksub_claim:sub_claim_subject_class_enum→sub_claim_subject_class_checktoken_quota:token_quota_key_id_epoch_pk→token_quota_pkeyIndex renames (103)
observation:idx_observation_start_brin→observation_phenomenon_start_idxbinding_queue:idx_binding_queue_due→binding_queue_next_attempt_at_idxfeature:idx_feature_canonical→feature_canonical_id_idxfeature:idx_feature_id_bytes→feature_id_bytes_idxfeature:idx_feature_rights_revoked→feature_id_rights_revoked_idxfeature:idx_feature_kind_lifecycle→feature_kind_lifecycle_idxfeature:idx_feature_kind_type→feature_kind_type_idxfeature:idx_feature_source→feature_source_id_id_idxfeature:idx_feature_external_ids→feature_external_ids_idxfeature:idx_feature_geom→feature_geom_idxfeature_canonical:idx_feature_canonical_members→feature_canonical_member_ids_idxfeature_component:idx_feature_component_kind→feature_component_kind_idxfeature_component:idx_feature_component_external_ids→feature_component_external_ids_idxfeature_link:idx_feature_link_b→feature_link_b_id_idxfeature_revision:idx_feature_revision_recorded→feature_revision_recorded_at_idxfederation_lapsed_copy:idx_federation_lapsed_copy_source→federation_lapsed_copy_peer_instance_id_source_id_idxfederation_outbox:idx_federation_outbox_created_at→federation_outbox_created_at_idxfederation_outbox:idx_federation_outbox_record→federation_outbox_record_class_record_id_seq_idxfederation_outbox:idx_federation_outbox_cursor→federation_outbox_txid_seq_idxfederation_subscription:idx_federation_subscription_peer→federation_subscription_peer_id_idxobservation_latest:idx_observation_latest_effective_brin→observation_latest_effective_from_idxobservation_latest:idx_observation_latest_crowd_record→observation_latest_crowd_record_id_idxobservation_latest:idx_observation_latest_expires→observation_latest_expires_at_idxobservation_latest:idx_observation_latest_component→observation_latest_feature_id_component_key_idxobservation_latest:idx_observation_latest_property_text→observation_latest_property_value_text_idxobservation_latest:idx_observation_latest_source→observation_latest_source_id_series_id_idxobservation_latest:idx_observation_latest_fuel_price→observation_latest_value_money_fuel_price_idxobservation_latest:idx_observation_latest_geom→observation_latest_geom_idxobservation_rollup_daily:idx_observation_rollup_daily_day→observation_rollup_daily_day_utc_idxobservation_rollup_hourly:idx_observation_rollup_hourly_hour→observation_rollup_hourly_hour_utc_idxoffer:idx_offer_canonical→offer_canonical_id_idxoffer:idx_offer_id_bytes→offer_id_bytes_idxoffer:idx_offer_rights_revoked→offer_id_rights_revoked_idxoffer:idx_offer_kind_valid_to→offer_kind_valid_to_idxoffer:idx_offer_source→offer_source_id_id_idxoffer:idx_offer_subject→offer_subject_id_component_key_idxoffer:idx_offer_geom→offer_geom_idxoffer_revision:idx_offer_revision_recorded→offer_revision_recorded_at_idxosm_road:idx_osm_road_highway→osm_road_highway_idxosm_road:idx_osm_road_ref→osm_road_ref_idxosm_road:idx_osm_road_geom→osm_road_geom_idxraw_payload:idx_raw_payload_base→raw_payload_source_id_base_hash_idxraw_payload:idx_raw_payload_source_time→raw_payload_source_id_first_fetched_at_idxraw_payload:idx_raw_payload_tier_seen→raw_payload_tier_last_seen_at_idxrecord_binding:idx_record_binding_status→record_binding_status_idxrecord_relation:idx_record_relation_to→record_relation_to_class_to_id_idxrecord_segment:idx_record_segment_segment→record_segment_segment_id_idxreport_evidence:idx_report_evidence_merged→report_evidence_merged_idxreport_evidence:idx_report_evidence_actor→report_evidence_actor_key_id_occurred_at_idxreport_evidence:idx_report_evidence_record→report_evidence_record_class_record_id_occurred_at_idxreport_refusal:idx_report_refusal_actor→report_refusal_actor_key_id_occurred_at_idxreport_refusal:idx_report_refusal_occurred→report_refusal_occurred_at_idxroad_segment:idx_road_segment_minzoom→road_segment_min_zoom_idxroad_segment:idx_road_segment_way→road_segment_way_id_idxroad_segment:idx_road_segment_geom→road_segment_geom_idxsensor_baseline:idx_sensor_baseline_source_bucket→sensor_baseline_source_dow_bucket_tod_bucket_idxsensor_segment:idx_sensor_segment_segment→sensor_segment_segment_id_idxsituation:idx_situation_canonical→situation_canonical_id_idxsituation:idx_situation_expires→situation_expires_at_idxsituation:idx_situation_group→situation_group_id_idxsituation:idx_situation_id_bytes→situation_id_bytes_idxsituation:idx_situation_rights_revoked→situation_id_rights_revoked_idxsituation:idx_situation_kind_type→situation_kind_type_idxsituation:idx_situation_source→situation_source_id_id_idxsituation:idx_situation_tombstoned→situation_tombstoned_at_idxsituation:idx_situation_valid_to→situation_valid_to_idxsituation:idx_situation_geom→situation_geom_idxsituation_effect:idx_situation_effect_kind_valid_to→situation_effect_kind_valid_to_idxsituation_effect:idx_situation_effect_geom→situation_effect_geom_idxsituation_revision:idx_situation_revision_recorded→situation_revision_recorded_at_idxsource_poll_attempt:idx_source_poll_attempt_time→source_poll_attempt_attempted_at_id_idxsource_poll_attempt:idx_source_poll_attempt_source_time→source_poll_attempt_source_attempted_at_idxsub_claim:idx_sub_claim_key→sub_claim_key_id_idxobservation:observation_pk→observation_pkeybinding_queue:binding_queue_record_class_record_id_effect_id_pk→binding_queue_pkeyfeature_component:feature_component_feature_id_key_pk→feature_component_pkeyfeature_link:feature_link_a_id_b_id_pk→feature_link_pkeyfeature_revision:feature_revision_feature_id_revision_pk→feature_revision_pkeyfederation_lapsed_copy:federation_lapsed_copy_record_class_record_id_pk→federation_lapsed_copy_pkeyfederation_peer_key:federation_peer_key_peer_instance_id_key_id_pk→federation_peer_key_pkeyfederation_source_receipt:federation_source_receipt_peer_instance_id_source_id_pk→federation_source_receipt_pkeyfederation_subscription:uq_federation_subscription_target→federation_subscription_target_keyfederation_tombstone:federation_tombstone_canonical_id_peer_instance_id_pk→federation_tombstone_pkeyjma_budget:jma_budget_egress_day_pk→jma_budget_pkeynsw_rfs_clock:nsw_rfs_clock_source_id_incident_id_pk→nsw_rfs_clock_pkeyobservation_latest:observation_latest_series→observation_latest_series_keyobservation_revision:observation_revision_source_id_feature_id_property_pk→observation_revision_pkeyobservation_rollup_daily:observation_rollup_daily_series_id_day_utc_pk→observation_rollup_daily_pkeyobservation_rollup_hourly:observation_rollup_hourly_series_id_hour_utc_pk→observation_rollup_hourly_pkeyoffer_revision:offer_revision_offer_id_revision_pk→offer_revision_pkeyon_demand_fetch:on_demand_fetch_source_id_cell_pk→on_demand_fetch_pkeyraw_payload:raw_payload_pk→raw_payload_pkeyrecord_binding:record_binding_record_class_record_id_effect_id_pk→record_binding_pkeyrecord_relation:record_relation_pk→record_relation_pkeyrecord_segment:record_segment_record_class_record_id_effect_id_seq_pk→record_segment_pkeysegment_observation:segment_observation_segment_id_source_pk→segment_observation_pkeysegment_profile:segment_profile_segment_id_dow_tod_hour_pk→segment_profile_pkeysensor_baseline:sensor_baseline_subject_key_dow_bucket_tod_bucket_method_pk→sensor_baseline_pkeysituation_effect:situation_effect_situation_id_effect_id_pk→situation_effect_pkeysituation_revision:situation_revision_situation_id_revision_pk→situation_revision_pkeysmn_cap_message:smn_cap_message_source_id_variant_pk→smn_cap_message_pkeysource_shrink:source_shrink_source_id_scope_pk→source_shrink_pkeytoken_quota:token_quota_key_id_epoch_pk→token_quota_pkeyPhysical column order (30 tables)
contributor_receiptfeaturefeature_canonicalfederation_instance_keyfederation_outboxfederation_peer_keyfederation_subscriptionfederation_tombstonegeonet_coverageissuer_keyoauth_grantobservationobservation_latestobservation_rollup_dailyobservation_rollup_hourlyofferosm_roadreport_evidencereportersegment_observationsegment_profilesegment_speedsensor_baselinesensor_segmentsituationsmn_cap_messagesourcesource_statusspent_tokensub_claim