broadcast migrations: replace older ones & add final removal

This commit is contained in:
stvnrlly
2022-10-25 11:52:56 -04:00
parent d37c2a53b8
commit 4737cefb1c
26 changed files with 616 additions and 53 deletions

View File

@@ -11,14 +11,28 @@ from notifications_utils.template import BroadcastMessageTemplate
from sqlalchemy.dialects import postgresql
from sqlalchemy.orm.session import Session
revision = '0336_broadcast_msg_content_2'
down_revision = '0335_broadcast_msg_content'
def upgrade():
pass
conn = op.get_bind()
results = conn.execute(sa.text("""
UPDATE
broadcast_message
SET
content = templates_history.content
FROM
templates_history
WHERE
broadcast_message.content is NULL and
broadcast_message.template_id = templates_history.id and
broadcast_message.template_version = templates_history.version
;
"""))
def downgrade():
pass
op.alter_column('broadcast_message', 'content', nullable=True)