From 822beb97e447e322933b0d46dbd0a6763a79cfee Mon Sep 17 00:00:00 2001 From: Tilly Whitson <35410637+tillyw@users.noreply.github.com> Date: Tue, 30 Aug 2022 17:24:36 -0500 Subject: [PATCH] Inserts new moped components --- .../1661896731916_insert_moped_components/down.sql | 3 +++ .../1661896731916_insert_moped_components/up.sql | 9 +++++++++ .../down.sql | 5 +++++ .../up.sql | 5 +++++ 4 files changed, 22 insertions(+) create mode 100644 moped-database/migrations/1661896731916_insert_moped_components/down.sql create mode 100644 moped-database/migrations/1661896731916_insert_moped_components/up.sql create mode 100644 moped-database/migrations/1661897396206_set_fk_public_moped_proj_components_component_id/down.sql create mode 100644 moped-database/migrations/1661897396206_set_fk_public_moped_proj_components_component_id/up.sql diff --git a/moped-database/migrations/1661896731916_insert_moped_components/down.sql b/moped-database/migrations/1661896731916_insert_moped_components/down.sql new file mode 100644 index 0000000000..65b771cac6 --- /dev/null +++ b/moped-database/migrations/1661896731916_insert_moped_components/down.sql @@ -0,0 +1,3 @@ +-- Delete added moped_components records +DELETE FROM public.moped_components WHERE component_subtype = 'RRFB'; +DELETE FROM public.moped_components WHERE component_subtype = 'Roundabout'; diff --git a/moped-database/migrations/1661896731916_insert_moped_components/up.sql b/moped-database/migrations/1661896731916_insert_moped_components/up.sql new file mode 100644 index 0000000000..eaa419791b --- /dev/null +++ b/moped-database/migrations/1661896731916_insert_moped_components/up.sql @@ -0,0 +1,9 @@ +-- Insert new moped_components +INSERT INTO public.moped_components ( + component_name, + status_id, + component_subtype, + line_representation + ) VALUES + ('Signage', 1, 'RRFB', false), + ('Intersection', 1, 'Roundabout', false); diff --git a/moped-database/migrations/1661897396206_set_fk_public_moped_proj_components_component_id/down.sql b/moped-database/migrations/1661897396206_set_fk_public_moped_proj_components_component_id/down.sql new file mode 100644 index 0000000000..056d5ff800 --- /dev/null +++ b/moped-database/migrations/1661897396206_set_fk_public_moped_proj_components_component_id/down.sql @@ -0,0 +1,5 @@ +alter table "public"."moped_proj_components" drop constraint "moped_proj_components_component_id_fkey", + add constraint "moped_proj_components_component_id_fkey" + foreign key ("component_id") + references "public"."moped_components" + ("component_id") on update no action on delete no action; diff --git a/moped-database/migrations/1661897396206_set_fk_public_moped_proj_components_component_id/up.sql b/moped-database/migrations/1661897396206_set_fk_public_moped_proj_components_component_id/up.sql new file mode 100644 index 0000000000..b72abcff9c --- /dev/null +++ b/moped-database/migrations/1661897396206_set_fk_public_moped_proj_components_component_id/up.sql @@ -0,0 +1,5 @@ +alter table "public"."moped_proj_components" drop constraint "moped_proj_components_component_id_fkey", + add constraint "moped_proj_components_component_id_fkey" + foreign key ("component_id") + references "public"."moped_components" + ("component_id") on update cascade on delete set null;