Skip to content

Commit

Permalink
feat: Adding a "Name" Column to "Flows" table (#3203)
Browse files Browse the repository at this point in the history
Co-authored-by: Rory Doak <[email protected]>
Co-authored-by: Dafydd Llŷr Pearson <[email protected]>
  • Loading branch information
3 people authored May 30, 2024
1 parent c250d10 commit 508175f
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 4 deletions.
10 changes: 10 additions & 0 deletions hasura.planx.uk/metadata/tables.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,7 @@
- creator_id
- data
- id
- name
- settings
- slug
- team_id
Expand All @@ -441,6 +442,7 @@
- creator_id
- data
- id
- name
- settings
- slug
- team_id
Expand Down Expand Up @@ -471,6 +473,7 @@
- creator_id
- data
- id
- name
- settings
- slug
- team_id
Expand All @@ -494,6 +497,7 @@
- creator_id
- data
- id
- name
- settings
- slug
- status
Expand All @@ -512,6 +516,7 @@
- creator_id
- data
- id
- name
- settings
- slug
- status
Expand All @@ -529,6 +534,7 @@
- creator_id
- data
- id
- name
- settings
- slug
- status
Expand All @@ -547,6 +553,7 @@
- creator_id
- data
- id
- name
- settings
- slug
- status
Expand All @@ -566,6 +573,7 @@
- creator_id
- data
- id
- name
- settings
- slug
- status
Expand All @@ -587,6 +595,7 @@
permission:
columns:
- data
- name
- settings
- slug
- status
Expand All @@ -606,6 +615,7 @@
permission:
columns:
- data
- name
- settings
- slug
- status
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
comment on column "public"."flows"."name" is NULL;

ALTER TABLE flows DROP COLUMN name;
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
alter table "public"."flows" add column "name" text
null;
comment on column "public"."flows"."name" is 'The name of the flow, entered by the user and used to generate the "slug"';

UPDATE flows
SET name = replace(concat(upper(substring(slug,1,1)),right(slug,-1)),'-',' ')
WHERE name IS NULL


12 changes: 8 additions & 4 deletions scripts/seed-database/write/flows.sql
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ CREATE TEMPORARY TABLE sync_flows (
settings jsonb,
copied_from uuid,
analytics_link text,
status text
status text,
name text
);

\copy sync_flows FROM '/tmp/flows.csv' WITH (FORMAT csv, DELIMITER ';');
Expand All @@ -26,7 +27,8 @@ INSERT INTO flows (
settings,
copied_from,
analytics_link,
status
status,
name
)
SELECT
id,
Expand All @@ -38,7 +40,8 @@ SELECT
settings,
copied_from,
NULL,
status
status,
name
FROM sync_flows
ON CONFLICT (id) DO UPDATE
SET
Expand All @@ -50,7 +53,8 @@ SET
settings = EXCLUDED.settings,
copied_from = EXCLUDED.copied_from,
analytics_link = NULL,
status = EXCLUDED.status;
status = EXCLUDED.status,
name = EXCLUDED.name;

-- ensure that original flows.version is overwritten to match new operation inserted below, else sharedb will fail
UPDATE flows SET version = 1;
Expand Down

0 comments on commit 508175f

Please sign in to comment.