mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-09 23:02:13 -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():
|
||||
op.execute("""
|
||||
drop trigger insert_template_redacted ON templates
|
||||
""")
|
||||
|
||||
op.execute("""
|
||||
drop function insert_redacted();
|
||||
""")
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user