Skip to content

Instantly share code, notes, and snippets.

@AhmedSamy
Last active September 25, 2019 17:05
Show Gist options
  • Save AhmedSamy/62e36c8d37c5835b37e090042ced73b7 to your computer and use it in GitHub Desktop.
Save AhmedSamy/62e36c8d37c5835b37e090042ced73b7 to your computer and use it in GitHub Desktop.
STUCK figo customers
SELECT c.uuid, u.email,cs.name, bp.id, bp.`state_changed_at`, fsj.`status`, fsj.`last_error`
FROM webapp.`bank_account_bank_data_providers` bp
LEFT JOIN webapp.`customer_bank_accounts` cba ON cba.`bank_account_id` = bp.`bank_account_id`
LEFT JOIN webapp.companies c ON c.uuid = cba.customer_uuid
LEFT JOIN webapp.`company_snapshots` cs ON cs.company_id = c.id AND cs.is_current = 1
LEFT JOIN webapp.users_companies uc ON uc.company_id = c.id
LEFT JOIN webapp.users u ON u.id = uc.user_id
LEFT JOIN banco.`figo_customers` fc ON fc.customer_uuid = c.uuid
LEFT JOIN banco.`figo_accesses` fa ON fa.`customer_id` = fc.id
LEFT JOIN banco.`figo_sync_jobs` fsj ON fsj.`access_id` = fa.id
WHERE bp.`bank_data_provider_id` = 1
AND bp.state = 'in_progress'
AND u.state = "phone_verified"
ORDER BY bp.`state_changed_at` DESC;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment