Skip to content

Commit

Permalink
merge branch.sql
Browse files Browse the repository at this point in the history
  • Loading branch information
Changaco committed Mar 5, 2020
1 parent 2f4af75 commit 83261bd
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
11 changes: 0 additions & 11 deletions sql/branch.sql

This file was deleted.

12 changes: 12 additions & 0 deletions sql/migrations.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2515,3 +2515,15 @@ UPDATE scheduled_payins

-- migration #117
ALTER TABLE notifications ADD COLUMN hidden_since timestamptz;

-- migration #118
ALTER TABLE email_blacklist ADD COLUMN ignored_by bigint REFERENCES participants;
UPDATE email_blacklist AS bl
SET ignore_after = current_timestamp
, ignored_by = e.participant
FROM emails e
WHERE lower(e.address) = lower(bl.address)
AND e.verified
AND (bl.ignore_after IS NULL OR bl.ignore_after > current_timestamp)
AND (bl.reason = 'bounce' AND bl.ts < (e.added_time + interval '24 hours') OR
bl.reason = 'complaint' AND bl.details = 'disavowed');
3 changes: 2 additions & 1 deletion sql/schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ COMMENT ON EXTENSION pg_stat_statements IS 'track execution statistics of all SQ

-- database metadata
CREATE TABLE db_meta (key text PRIMARY KEY, value jsonb);
INSERT INTO db_meta (key, value) VALUES ('schema_version', '117'::jsonb);
INSERT INTO db_meta (key, value) VALUES ('schema_version', '118'::jsonb);


-- app configuration
Expand Down Expand Up @@ -779,6 +779,7 @@ CREATE TABLE email_blacklist
, ses_data jsonb
, ignore_after timestamptz
, report_id text
, ignored_by bigint REFERENCES participants
);

CREATE INDEX email_blacklist_idx ON email_blacklist (lower(address));
Expand Down

0 comments on commit 83261bd

Please sign in to comment.