-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Feedback sync script [skip pizza]
- Loading branch information
1 parent
ce6e37e
commit 8d74478
Showing
3 changed files
with
88 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
-- insert feedback overwriting conflicts | ||
CREATE TEMPORARY TABLE sync_feedback ( | ||
id integer, | ||
team_id integer, | ||
flow_id uuid, | ||
created_at timestamptz, | ||
node_id text, | ||
device jsonb, | ||
user_data jsonb, | ||
user_context text, | ||
user_comment text, | ||
feedback_type text, | ||
status text, | ||
node_type text, | ||
node_data jsonb | ||
); | ||
|
||
\copy sync_feedback FROM '/tmp/feedback.csv' WITH (FORMAT csv, DELIMITER ';'); | ||
|
||
INSERT INTO | ||
feedback ( | ||
id, | ||
team_id, | ||
flow_id, | ||
created_at, | ||
node_id, | ||
device, | ||
user_data, | ||
user_context, | ||
user_comment, | ||
feedback_type, | ||
status, | ||
node_type, | ||
node_data | ||
) | ||
SELECT | ||
id, | ||
team_id, | ||
flow_id, | ||
created_at, | ||
node_id, | ||
device, | ||
user_data, | ||
user_context, | ||
user_comment, | ||
feedback_type, | ||
status, | ||
node_type, | ||
node_data | ||
FROM | ||
sync_feedback ON CONFLICT (id) DO | ||
UPDATE | ||
SET | ||
id = EXCLUDED.id, | ||
team_id = EXCLUDED.team_id, | ||
flow_id = EXCLUDED.flow_id, | ||
created_at = EXCLUDED.created_at, | ||
node_id = EXCLUDED.node_id, | ||
device = EXCLUDED.device, | ||
user_data = EXCLUDED.user_data, | ||
user_context = EXCLUDED.user_context, | ||
user_comment = EXCLUDED.user_comment, | ||
feedback_type = EXCLUDED.feedback_type, | ||
status = EXCLUDED.status, | ||
node_type = EXCLUDED.node_type, | ||
node_data = EXCLUDED.node_data; | ||
SELECT | ||
setval('feedback_id_seq', max(id)) | ||
FROM | ||
feedback; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,12 @@ | ||
-- Mandatory tables | ||
\include write/users.sql | ||
\include write/teams.sql | ||
\include write/flows.sql | ||
\include write/flow_document_templates.sql | ||
\include write/published_flows.sql | ||
\include write/team_members.sql | ||
\include write/team_integrations.sql | ||
\include write/team_themes.sql | ||
\include write/team_themes.sql | ||
|
||
-- Optional tables | ||
-- \include write/feedback.sql |