migrations: updated
This commit is contained in:
parent
7aa60d8aed
commit
2e6ecad00a
60
migrations/versions/70ab3c81827a_.py
Normal file
60
migrations/versions/70ab3c81827a_.py
Normal file
@ -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 ###
|
Loading…
Reference in New Issue
Block a user