37 lines
1.6 KiB
Python
37 lines
1.6 KiB
Python
"""Add PDF to Task Order
|
|
|
|
Revision ID: 1f690989e38e
|
|
Revises: 0ff4c31c4d28
|
|
Create Date: 2019-02-04 15:56:57.642156
|
|
|
|
"""
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
from sqlalchemy.dialects import postgresql
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision = '1f690989e38e'
|
|
down_revision = '0ff4c31c4d28'
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade():
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.add_column('task_orders', sa.Column('pdf_attachment_id', postgresql.UUID(as_uuid=True), nullable=True))
|
|
op.drop_constraint('task_orders_attachments_attachment_id', 'task_orders', type_='foreignkey')
|
|
op.alter_column('task_orders', 'attachment_id', new_column_name='csp_attachment_id')
|
|
op.create_foreign_key('task_orders_attachments_pdf_attachment_id', 'task_orders', 'attachments', ['pdf_attachment_id'], ['id'])
|
|
op.create_foreign_key('task_orders_attachments_csp_attachment_id', 'task_orders', 'attachments', ['csp_attachment_id'], ['id'])
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
def downgrade():
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.drop_constraint('task_orders_attachments_csp_attachment_id', 'task_orders', type_='foreignkey')
|
|
op.drop_constraint('task_orders_attachments_pdf_attachment_id', 'task_orders', type_='foreignkey')
|
|
op.alter_column('task_orders', 'csp_attachment_id', new_column_name='attachment_id')
|
|
op.create_foreign_key('task_orders_attachments_attachment_id', 'task_orders', 'attachments', ['attachment_id'], ['id'])
|
|
op.drop_column('task_orders', 'pdf_attachment_id')
|
|
# ### end Alembic commands ###
|