From e05bd6817cca21a4fa9919ff9e8a02817b441278 Mon Sep 17 00:00:00 2001 From: Gurjeet Matharu Date: Wed, 3 Aug 2022 11:02:22 -0700 Subject: [PATCH] fix: adding project contacts to dev data --- schema/data/dev/004_cif_project.sql | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/schema/data/dev/004_cif_project.sql b/schema/data/dev/004_cif_project.sql index e2b5ef2789..1314d61810 100644 --- a/schema/data/dev/004_cif_project.sql +++ b/schema/data/dev/004_cif_project.sql @@ -38,14 +38,23 @@ do $$ ), 'create', 'cif', 'project_manager', 'pending', 'project_manager', current_revision.id); - update cif.form_change - set new_form_data= jsonb_build_object( + insert into cif.form_change( + new_form_data, + operation, + form_data_schema_name, + form_data_table_name, + change_status, + json_schema_name, + project_revision_id + ) + values + ( + json_build_object( 'contactId', index, - 'projectId', index, + 'projectId', (select form_data_record_id from cif.form_change where form_data_table_name='project' and project_revision_id=current_revision.id), 'contactIndex', 1 - ) - where project_revision_id=current_revision.id and form_data_table_name='project_contact'; - + ), + 'create', 'cif', 'project_contact', 'pending', 'project_contact', current_revision.id); end loop; end $$;