Files
notifications-api/migrations/versions/0297_template_redacted_fix.py
Cliff Hill 1157f5639d black, isort, flake8
Signed-off-by: Cliff Hill <Clifford.hill@gsa.gov>
2023-12-08 21:43:52 -05:00

28 lines
646 B
Python

"""
Revision ID: 0297_template_redacted_fix
Revises: 0296_agreement_signed_by_person
Create Date: 2019-06-25 17:02:14.350064
"""
from alembic import op
revision = "0297_template_redacted_fix"
down_revision = "0296_agreement_signed_by_person"
def upgrade():
op.execute(
"""
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)
;
"""
)
def downgrade():
pass