cs / migrations /versions /a4ba6502ed21_add_predict_table.py
haoqi7's picture
Upload 1527 files
a8eb386
"""add Predict table
Revision ID: a4ba6502ed21
Revises: e48ebc1ff51c
Create Date: 2021-03-09 18:57:38.804686
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'a4ba6502ed21'
down_revision = 'e48ebc1ff51c'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('predict',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('img_name', sa.String(length=64), nullable=True),
sa.Column('img_path', sa.String(length=128), nullable=True),
sa.Column('size', sa.String(length=20), nullable=True),
sa.Column('predict_time', sa.DateTime(), nullable=True),
sa.Column('predict_result', sa.String(length=64), nullable=True),
sa.Column('user_id', sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
sa.PrimaryKeyConstraint('id')
)
op.create_index(op.f('ix_predict_img_name'), 'predict', ['img_name'], unique=True)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_index(op.f('ix_predict_img_name'), table_name='predict')
op.drop_table('predict')
# ### end Alembic commands ###