mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-15 09:42:38 -05:00
Update notifications/sms|email endpoint to send the template version to the queue. Update the process_job celery talk to send the template version to the queue. When the send_sms|send_email task runs it will get the template by id and version. Created a data migration script to add the template_vesion column for jobs and notifications. The existing jobs and notifications are given the template_version of the current template. There is a chance this is the wrong template version, but deemed okay since the application is not live. Create unit test for the dao_get_template_versions method. Rename /template/<id>/version to /template/<id>/versions which returns all versions for that template id and service id.
30 lines
1.0 KiB
Python
30 lines
1.0 KiB
Python
"""empty message
|
|
|
|
Revision ID: 0014_add_template_version
|
|
Revises: 0012_complete_provider_details
|
|
Create Date: 2016-05-11 16:00:51.478012
|
|
|
|
"""
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision = '0014_add_template_version'
|
|
down_revision = '0012_complete_provider_details'
|
|
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
from sqlalchemy.dialects import postgresql
|
|
|
|
def upgrade():
|
|
op.add_column('jobs', sa.Column('template_version', sa.Integer(), nullable=True))
|
|
op.get_bind()
|
|
op.execute('update jobs set template_version = (select version from templates where id = template_id)')
|
|
op.add_column('notifications', sa.Column('template_version', sa.Integer(), nullable=True))
|
|
op.execute('update notifications set template_version = (select version from templates where id = template_id)')
|
|
op.alter_column('jobs', 'template_version', nullable=False)
|
|
op.alter_column('notifications', 'template_version', nullable=False)
|
|
|
|
|
|
def downgrade():
|
|
op.drop_column('notifications', 'template_version')
|
|
op.drop_column('jobs', 'template_version')
|