Skip to content
Snippets Groups Projects

Add detailed integrity checking

+ 12
0
#!/bin/bash
# Exit immediately on uninitialized variable or error, and print each command.
set -uex
drush sql:query --database=migrate "SELECT n.nid AS node_id, c.uid AS user_id, fdf_pmn.field_project_machine_name_value, fdf_is.field_issue_status_value IN (3,5,6,18,17,7,2) AS closed, coalesce(c.cid = fdf_ic.field_issue_credit_target_id, 0) AS credited, coalesce(group_concat(DISTINCT fdf_aav.field_attribute_as_volunteer_value ORDER BY fdf_aav.field_attribute_as_volunteer_value), 0) AS as_volunteer, group_concat(DISTINCT fdf_act.field_attribute_contribution_to_target_id ORDER BY fdf_act.field_attribute_contribution_to_target_id) AS organizations, group_concat(DISTINCT fdf_fc.field_for_customer_target_id ORDER BY fdf_fc.field_for_customer_target_id) AS customers FROM node n LEFT JOIN field_data_field_project fdf_p ON fdf_p.entity_id = n.nid LEFT JOIN field_data_field_project_machine_name fdf_pmn ON fdf_pmn.entity_id = fdf_p.field_project_target_id LEFT JOIN field_data_field_issue_status fdf_is ON fdf_is.entity_id = n.nid LEFT JOIN comment c ON c.nid = n.nid AND c.status = 1 AND c.uid > 0 LEFT JOIN field_data_field_issue_credit fdf_ic ON fdf_ic.field_issue_credit_target_id = c.cid LEFT JOIN field_data_field_attribute_as_volunteer fdf_aav ON fdf_aav.entity_id = c.cid LEFT JOIN field_data_field_attribute_contribution_to fdf_act ON fdf_act.entity_id = c.cid LEFT JOIN field_data_field_for_customer fdf_fc ON fdf_fc.entity_id = c.cid WHERE n.status = 1 AND n.type = 'project_issue' GROUP BY n.nid, c.uid ORDER BY node_id, user_id;" > d7.tsv &
drush sql:query "SELECT cast(REPLACE(fsl.field_source_link_uri, 'https://www.drupal.org/node/', '') AS unsigned) AS node_id, fcu.field_contributor_user_target_id AS user_id, nf_pn.field_project_name_value, NOT nf_d.field_draft_value AS closed, fctc.field_credit_this_contributor_value AS credited, fcv.field_contributor_volunteer_value volunteer, fco.field_contributor_organisation_target_id organization, fcc.field_contributor_customer_target_id customer FROM node__field_source_link fsl LEFT JOIN node__field_contributors fc ON fsl.entity_id = fc.entity_id INNER JOIN paragraph__field_contributor_user fcu ON fc.field_contributors_target_id = fcu.entity_id LEFT JOIN node__field_project_name nf_pn ON nf_pn.entity_id = fsl.entity_id LEFT JOIN node__field_draft nf_d ON nf_d.entity_id = fsl.entity_id LEFT JOIN paragraph__field_contributor_volunteer fcv ON fc.field_contributors_target_id = fcv.entity_id LEFT JOIN paragraph__field_contributor_organisation fco ON fc.field_contributors_target_id = fco.entity_id LEFT JOIN paragraph__field_contributor_customer fcc ON fc.field_contributors_target_id = fcc.entity_id LEFT JOIN paragraph__field_credit_this_contributor fctc ON fc.field_contributors_target_id = fctc.entity_id GROUP BY node_id, user_id ORDER BY node_id, user_id;" > d10.tsv
wait
diff -u d7.tsv d10.tsv
Loading