Skip to content

Commit

Permalink
Merge pull request #1319 from cityofaustin/add_ems_relation_to_persons
Browse files Browse the repository at this point in the history
Add ems id to the person and primary persons table
  • Loading branch information
roseeichelmann authored Dec 21, 2023
2 parents 5b9261b + cde706a commit 01ed35e
Show file tree
Hide file tree
Showing 12 changed files with 46 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@ object_relationships:
remote_table:
name: atd_txdot_crashes
schema: public
- name: ems_incident
using:
manual_configuration:
column_mapping:
ems_id: id
insertion_order: null
remote_table:
name: ems__incidents
schema: public
- name: ethnicity
using:
manual_configuration:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@ object_relationships:
remote_table:
name: atd_txdot_crashes
schema: public
- name: ems_incident
using:
manual_configuration:
column_mapping:
ems_id: id
insertion_order: null
remote_table:
name: ems__incidents
schema: public
- name: ethnicity
using:
manual_configuration:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
table:
name: ems__incidents
schema: public
1 change: 1 addition & 0 deletions atd-vzd/metadata/databases/default/tables/tables.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
- "!include public_atd_txdot_units.yaml"
- "!include public_council_districts.yaml"
- "!include public_crash_notes.yaml"
- "!include public_ems__incidents.yaml"
- "!include public_engineering_areas.yaml"
- "!include public_fatalities.yaml"
- "!include public_grafana_crash_counts.yaml"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ALTER TABLE public.atd_txdot_person
DROP COLUMN IF EXISTS ems_id;
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
alter table "public"."atd_txdot_primaryperson" add column "ems_id" integer
null;

COMMENT ON COLUMN public.atd_txdot_primaryperson.ems_id IS 'This field holds the foreign key that references a single record in the ems__incidents table.';
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ALTER TABLE public.atd_txdot_primaryperson
DROP COLUMN IF EXISTS ems_id;
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
alter table "public"."atd_txdot_person" add column "ems_id" integer
null;

COMMENT ON COLUMN public.atd_txdot_person.ems_id IS 'This field holds the foreign key that references a single record in the ems__incidents table';
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
alter table "public"."atd_txdot_primaryperson" drop constraint "atd_txdot_primaryperson_ems_id_fkey";
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
alter table "public"."atd_txdot_primaryperson"
add constraint "atd_txdot_primaryperson_ems_id_fkey"
foreign key ("ems_id")
references "public"."ems__incidents"
("id") on update restrict on delete set null;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
alter table "public"."atd_txdot_person" drop constraint "atd_txdot_person_ems_id_fkey";
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
alter table "public"."atd_txdot_person"
add constraint "atd_txdot_person_ems_id_fkey"
foreign key ("ems_id")
references "public"."ems__incidents"
("id") on update restrict on delete set null;

0 comments on commit 01ed35e

Please sign in to comment.