193 migrations updated

This commit is contained in:
Ivan Grishaev 2017-12-27 18:47:37 +03:00
parent b77a2312ff
commit bea4321ca4
3 changed files with 67 additions and 8 deletions

View File

@ -1,6 +1,35 @@
begin;
BEGIN;
alter table users
drop column is_hidden;
ALTER TABLE users
DROP COLUMN is_hidden;
commit;
-- restore the previous version of the view
CREATE OR REPLACE VIEW "public"."claims_view" AS
SELECT
i.title AS issue_title,
i.issue_number,
r.repo AS repo_name,
r.owner AS repo_owner,
COALESCE(u.name, u.login) AS user_name,
u.avatar_url AS user_avatar_url,
i.payout_receipt,
p.updated,
i.updated AS issue_updated,
i.balance_eth,
i.tokens,
i.value_usd,
p.state AS pr_state,
i.is_open AS issue_open,
(case when u.address IS NULL THEN false ELSE true END) AS user_has_address
FROM issues i,
users u,
repositories r,
pull_requests p
WHERE r.repo_id = i.repo_id
AND p.issue_id = i.issue_id
AND p.user_id = u.id
AND i.contract_address IS NOT NULL
AND i.comment_id IS NOT NULL
ORDER BY p.updated;
COMMIT;

View File

@ -1,6 +1,35 @@
begin;
BEGIN;
alter table users
add column is_hidden boolean not null default false;
ALTER TABLE users
ADD COLUMN is_hidden BOOLEAN NOT NULL DEFAULT FALSE;
commit;
CREATE OR REPLACE VIEW "public"."claims_view" AS
SELECT
i.title AS issue_title,
i.issue_number,
r.repo AS repo_name,
r.owner AS repo_owner,
COALESCE(u.name, u.login) AS user_name,
u.avatar_url AS user_avatar_url,
i.payout_receipt,
p.updated,
i.updated AS issue_updated,
i.balance_eth,
i.tokens,
i.value_usd,
p.state AS pr_state,
i.is_open AS issue_open,
(case when u.address IS NULL THEN false ELSE true END) AS user_has_address
FROM issues i,
users u,
repositories r,
pull_requests p
WHERE r.repo_id = i.repo_id
AND p.issue_id = i.issue_id
AND p.user_id = u.id
AND i.contract_address IS NOT NULL
AND i.comment_id IS NOT NULL
AND NOT u.is_hidden -- added
ORDER BY p.updated;
COMMIT;

View File

@ -571,6 +571,7 @@ WHERE
pr.commit_sha = i.commit_sha
AND u.id = pr.user_id
AND i.payout_receipt IS NOT NULL
AND NOT u.is_hidden
GROUP BY u.id
ORDER BY total_usd DESC
LIMIT 5;