diff --git a/LUPMIS2_Database_Schema_Summary.docx b/LUPMIS2_Database_Schema_Summary.docx new file mode 100644 index 0000000..36bb42f Binary files /dev/null and b/LUPMIS2_Database_Schema_Summary.docx differ diff --git a/LUPMIS2_Schema_ERM.png b/LUPMIS2_Schema_ERM.png new file mode 100644 index 0000000..3f8c917 Binary files /dev/null and b/LUPMIS2_Schema_ERM.png differ diff --git a/LUPMIS2_Schema_ERM.svg b/LUPMIS2_Schema_ERM.svg new file mode 100644 index 0000000..b82cc8c --- /dev/null +++ b/LUPMIS2_Schema_ERM.svg @@ -0,0 +1,147 @@ + + + + + + + + + + + + + foreign key enforced by the database + + joined on a shared value only + + + + permit + the only schema with enforced referential integrity + + + applications + id · application_code + + + applicants + applicant_id + + + comments · stages + application_code + + + application_agents + + application_consultants + + application_documents + + application_status_history + + mining_applications + + + + + + + + application_id + + + + ON DELETE + CASCADE + deleting an + application + removes all five + + + + dataroom + a versioning chain held together by uuid alone + + + datasets + the catalogue entry + + + dataset_versions + open or finalised + + + dataset_resources + the files · sha256 + + + downloads + hashed requester + + + + + dataset_id + version_id + resource_id + + + audit_log + status changes, by dataset and version + datasets.current_version_id points back + to the version being served. + + + + spatial + scoped by districtid; parcels keyed by UPN + + Administrative hierarchy + + area_region + + area_districts + + area_collectorzones + + area_gra + + + + regionid + districtid + tscid + + Parcels — the live tables + + gh_upn_grid + + lu_parcels + + lu_buildings + + …_upload_tmp + + + + issues upn + upn + promoted by + transfer_upload_to_master_json + + Legacy tables — where the only enforced keys are + + parcels + + buildings + + pi_buildings + + + parcel_id + not lu_parcels + diff --git a/LUPMIS2_Schema_Map.png b/LUPMIS2_Schema_Map.png new file mode 100644 index 0000000..d9961b5 Binary files /dev/null and b/LUPMIS2_Schema_Map.png differ diff --git a/LUPMIS2_Schema_Map.svg b/LUPMIS2_Schema_Map.svg new file mode 100644 index 0000000..049f7c7 --- /dev/null +++ b/LUPMIS2_Schema_Map.svg @@ -0,0 +1,61 @@ + + + + + + + + + + + admin + 13 tables · 28 functions + Users, roles, menus, privileges, + API tokens, access logging. + + + dataroom + 5 tables · 18 functions + Published datasets, versions, + licensing, download tracking. + + + permit + 10 tables · 43 functions + Development and mining permit + applications and documents. + + + + spatial + 32 tables · 30 functions + All mapping data. The schema the + field application reads. + + + area_districts + the district register — districtid + + Everything else in spatial is scoped by + districtid: parcels, zones, roads, + facilities, contours, the UPN grid. + + + One foreign key leaves the four + schemas entirely: zoning_districts + → reference.zoning_types. + + + + + + + district_id + district_ref + project_district_id + + + + Dashed = joined by shared value, not by an enforced constraint. No foreign key crosses a schema boundary. +