mirror of
https://github.com/GSA/notifications-api.git
synced 2026-01-30 14:31:57 -05:00
Merge pull request #2341 from alphagov/migrate_postage_template_history
Migrate postage into templates_history table
This commit is contained in:
28
migrations/versions/0256_set_postage_tmplt_hstr.py
Normal file
28
migrations/versions/0256_set_postage_tmplt_hstr.py
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
"""
|
||||||
|
|
||||||
|
Revision ID: 0256_set_postage_tmplt_hstr
|
||||||
|
Revises: 0255_another_letter_org
|
||||||
|
Create Date: 2019-02-05 14:51:30.808067
|
||||||
|
|
||||||
|
"""
|
||||||
|
from alembic import op
|
||||||
|
import sqlalchemy as sa
|
||||||
|
|
||||||
|
|
||||||
|
revision = '0256_set_postage_tmplt_hstr'
|
||||||
|
down_revision = '0255_another_letter_org'
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade():
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
op.execute(
|
||||||
|
"""UPDATE templates_history SET postage = services.postage
|
||||||
|
FROM services WHERE template_type = 'letter' AND service_id = services.id"""
|
||||||
|
)
|
||||||
|
# ### end Alembic commands ###
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade():
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
op.execute("UPDATE templates_history SET postage = null WHERE template_type = 'letter'")
|
||||||
|
# ### end Alembic commands ###
|
||||||
Reference in New Issue
Block a user