From 2e6ecad00a04c2b051bc343d12c657103ccaf6d3 Mon Sep 17 00:00:00 2001 From: dogeystamp Date: Sun, 7 May 2023 21:52:30 -0400 Subject: [PATCH] migrations: updated --- migrations/versions/70ab3c81827a_.py | 60 ++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 migrations/versions/70ab3c81827a_.py diff --git a/migrations/versions/70ab3c81827a_.py b/migrations/versions/70ab3c81827a_.py new file mode 100644 index 0000000..a8c5c20 --- /dev/null +++ b/migrations/versions/70ab3c81827a_.py @@ -0,0 +1,60 @@ +"""empty message + +Revision ID: 70ab3c81827a +Revises: 4cd7cdbc2d1f +Create Date: 2023-05-07 21:52:08.250195 + +""" +from alembic import op +import sqlalchemy as sa +import sqlalchemy_utils + + +# revision identifiers, used by Alembic. +revision = '70ab3c81827a' +down_revision = '4cd7cdbc2d1f' +branch_labels = None +depends_on = None + + +def upgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.create_table('uploads', + sa.Column('upload_id', sa.String(), nullable=False), + sa.Column('share_id', sqlalchemy_utils.types.uuid.UUIDType(), nullable=True), + sa.Column('create_date', sa.DateTime(), nullable=False), + sa.Column('total_chunks', sa.Integer(), nullable=False), + sa.Column('recv_chunks', sa.Integer(), nullable=False), + sa.Column('completed', sa.Boolean(), nullable=False), + sa.ForeignKeyConstraint(['share_id'], ['shares.share_id'], ), + sa.PrimaryKeyConstraint('upload_id') + ) + op.create_table('chunks', + sa.Column('chunk_id', sa.Integer(), autoincrement=True, nullable=False), + sa.Column('create_date', sa.DateTime(), nullable=False), + sa.Column('index', sa.Integer(), nullable=False), + sa.Column('upload_id', sa.String(), nullable=True), + sa.Column('filename', sa.String(), nullable=False), + sa.ForeignKeyConstraint(['upload_id'], ['uploads.upload_id'], ), + sa.PrimaryKeyConstraint('chunk_id') + ) + with op.batch_alter_table('shares', schema=None) as batch_op: + batch_op.alter_column('share_id', + existing_type=sa.NUMERIC(precision=16), + type_=sqlalchemy_utils.types.uuid.UUIDType(), + existing_nullable=False) + + # ### end Alembic commands ### + + +def downgrade(): + # ### commands auto generated by Alembic - please adjust! ### + with op.batch_alter_table('shares', schema=None) as batch_op: + batch_op.alter_column('share_id', + existing_type=sqlalchemy_utils.types.uuid.UUIDType(), + type_=sa.NUMERIC(precision=16), + existing_nullable=False) + + op.drop_table('chunks') + op.drop_table('uploads') + # ### end Alembic commands ###