diff --git a/resources/migrations/20170312190143-open-claim-query-fix.down.sql b/resources/migrations/20170312190143-open-claim-query-fix.down.sql new file mode 100644 index 0000000..e69de29 diff --git a/resources/migrations/20170312190143-open-claim-query-fix.up.sql b/resources/migrations/20170312190143-open-claim-query-fix.up.sql new file mode 100644 index 0000000..9f576b3 --- /dev/null +++ b/resources/migrations/20170312190143-open-claim-query-fix.up.sql @@ -0,0 +1,48 @@ +CREATE OR REPLACE VIEW "public"."activity_feed_view" AS SELECT 'open-claim'::text AS type, + claims_view.issue_title, + claims_view.repo_name, + claims_view.repo_owner, + claims_view.issue_number, + claims_view.user_name, + claims_view.user_avatar_url, + claims_view.balance, + claims_view.updated + FROM claims_view + WHERE claims_view.pr_state in (0,1) AND claims_view.payout_receipt IS NULL +UNION + SELECT 'claim-payout'::text AS type, + claims_view.issue_title, + claims_view.repo_name, + claims_view.repo_owner, + claims_view.issue_number, + claims_view.user_name, + claims_view.user_avatar_url, + claims_view.balance, + claims_view.updated + FROM claims_view + WHERE claims_view.pr_state = 1 AND claims_view.payout_receipt IS NOT NULL +UNION + SELECT 'new-bounty'::text AS type, + bounties_view.issue_title, + bounties_view.repo_name, + bounties_view.repo_owner, + bounties_view.issue_number, + bounties_view.user_name, + bounties_view.user_avatar_url, + bounties_view.balance, + bounties_view.updated + FROM bounties_view + WHERE bounties_view.balance = 0::numeric AND bounties_view.payout_receipt IS NULL +UNION + SELECT 'balance-update'::text AS type, + bounties_view.issue_title, + bounties_view.repo_name, + bounties_view.repo_owner, + bounties_view.issue_number, + bounties_view.user_name, + bounties_view.user_avatar_url, + bounties_view.balance, + bounties_view.updated + FROM bounties_view + WHERE bounties_view.balance > 0::numeric AND bounties_view.payout_receipt IS NULL + ORDER BY updated DESC;