add attachment model and task order relation to it
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
"""add task order association to attachments
|
||||
|
||||
Revision ID: 14cd800904bc
|
||||
Revises: d7db8fd35b41
|
||||
Create Date: 2018-08-24 11:28:30.894412
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '14cd800904bc'
|
||||
down_revision = 'd7db8fd35b41'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('task_order', sa.Column('attachment_id', sa.Integer(), nullable=True))
|
||||
op.create_foreign_key(None, 'task_order', 'attachments', ['attachment_id'], ['id'])
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_constraint(None, 'task_order', type_='foreignkey')
|
||||
op.drop_column('task_order', 'attachment_id')
|
||||
# ### end Alembic commands ###
|
36
alembic/versions/d7db8fd35b41_add_attachment_table.py
Normal file
36
alembic/versions/d7db8fd35b41_add_attachment_table.py
Normal file
@@ -0,0 +1,36 @@
|
||||
"""add attachment table
|
||||
|
||||
Revision ID: d7db8fd35b41
|
||||
Revises: 0845b2f0f401
|
||||
Create Date: 2018-08-24 11:27:15.317181
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'd7db8fd35b41'
|
||||
down_revision = '0845b2f0f401'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('attachments',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('filename', sa.String(), nullable=True),
|
||||
sa.Column('object_name', sa.String(), nullable=True),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
sa.UniqueConstraint('object_name')
|
||||
)
|
||||
op.create_unique_constraint(None, 'task_order', ['number'])
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_constraint(None, 'task_order', type_='unique')
|
||||
op.drop_table('attachments')
|
||||
# ### end Alembic commands ###
|
Reference in New Issue
Block a user