mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-03 01:41:05 -05:00
Resign from trigger solution as we couldn't make it work
This commit is contained in:
@@ -21,32 +21,6 @@ def upgrade():
|
|||||||
;
|
;
|
||||||
""")
|
""")
|
||||||
|
|
||||||
op.execute("""
|
|
||||||
create or replace function insert_redacted()
|
|
||||||
returns trigger AS
|
|
||||||
$$
|
|
||||||
BEGIN
|
|
||||||
INSERT INTO template_redacted (template_id, redact_personalisation, updated_at, updated_by_id)
|
|
||||||
SELECT templates.id, FALSE, now(), templates.created_by_id
|
|
||||||
FROM templates
|
|
||||||
WHERE templates.id NOT IN (SELECT template_id FROM template_redacted WHERE template_id = templates.id);
|
|
||||||
RETURN NEW;
|
|
||||||
END;
|
|
||||||
$$ LANGUAGE plpgsql;
|
|
||||||
""")
|
|
||||||
|
|
||||||
op.execute("""
|
|
||||||
CREATE TRIGGER insert_template_redacted AFTER INSERT ON templates
|
|
||||||
FOR EACH ROW
|
|
||||||
EXECUTE PROCEDURE insert_redacted();
|
|
||||||
""")
|
|
||||||
|
|
||||||
|
|
||||||
def downgrade():
|
def downgrade():
|
||||||
op.execute("""
|
pass
|
||||||
drop trigger insert_template_redacted ON templates
|
|
||||||
""")
|
|
||||||
|
|
||||||
op.execute("""
|
|
||||||
drop function insert_redacted();
|
|
||||||
""")
|
|
||||||
|
|||||||
Reference in New Issue
Block a user