summary history files

web/migrations/versions/e16799a209b1_tags.py
"""tags

Revision ID: e16799a209b1
Revises: 464db55c5bbc
Create Date: 2022-06-13 18:18:41.333025

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = 'e16799a209b1'
down_revision = '464db55c5bbc'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('tag',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=128), nullable=True),
    sa.Column('desc', sa.String(length=128), nullable=True),
    sa.Column('user_id', sa.Integer(), nullable=True),
    sa.Column('date_added', sa.DateTime(), nullable=True),
    sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('name', 'user_id')
    )
    op.create_table('tag_transaction',
    sa.Column('tag_id', sa.Integer(), nullable=False),
    sa.Column('transaction_id', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['tag_id'], ['tag.id'], ),
    sa.ForeignKeyConstraint(['transaction_id'], ['tx.id'], ),
    sa.PrimaryKeyConstraint('tag_id', 'transaction_id')
    )
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('tag_transaction')
    op.drop_table('tag')
    # ### end Alembic commands ###