deleted migrations

i can't figure out how to fix this db mess so
This commit is contained in:
dogeystamp 2023-07-15 22:37:36 -04:00
parent 996de46127
commit 29f854f3a5
Signed by: dogeystamp
GPG Key ID: 7225FE3592EFFA38
3 changed files with 82 additions and 140 deletions

View File

@ -1,68 +0,0 @@
"""empty message
Revision ID: 4cd7cdbc2d1f
Revises:
Create Date: 2023-04-30 17:42:00.329050
"""
from alembic import op
import sqlalchemy as sa
import sqlalchemy_utils
# revision identifiers, used by Alembic.
revision = "4cd7cdbc2d1f"
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table(
"blacklist_tokens",
sa.Column("id", sa.Integer(), autoincrement=True, nullable=False),
sa.Column("token", sa.String(length=500), nullable=False),
sa.Column("expires", sa.DateTime(), nullable=False),
sa.PrimaryKeyConstraint("id"),
sa.UniqueConstraint("token"),
)
op.create_table(
"server_settings",
sa.Column("id", sa.Integer(), autoincrement=True, nullable=False),
sa.Column("default_permissions_number", sa.BigInteger(), nullable=False),
sa.PrimaryKeyConstraint("id"),
)
op.create_table(
"users",
sa.Column("username", sa.String(length=255), nullable=False),
sa.Column("password", sa.String(length=255), nullable=False),
sa.Column("register_date", sa.DateTime(), nullable=False),
sa.Column("permissions_number", sa.BigInteger(), nullable=False),
sa.PrimaryKeyConstraint("username"),
sa.UniqueConstraint("username"),
)
op.create_table(
"shares",
sa.Column("share_id", sqlalchemy_utils.types.uuid.UUIDType(), nullable=False),
sa.Column("owner_name", sa.String(), nullable=True),
sa.Column("initialized", sa.Boolean(), nullable=False),
sa.Column("locked", sa.Boolean(), nullable=False),
sa.Column("create_date", sa.DateTime(), nullable=False),
sa.Column("file_name", sa.String(), nullable=False),
sa.ForeignKeyConstraint(
["owner_name"],
["users.username"],
),
sa.PrimaryKeyConstraint("share_id"),
)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table("shares")
op.drop_table("users")
op.drop_table("server_settings")
op.drop_table("blacklist_tokens")
# ### end Alembic commands ###

View File

@ -1,72 +0,0 @@
"""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 ###

View File

@ -0,0 +1,82 @@
"""empty message
Revision ID: e8d2a7570f70
Revises:
Create Date: 2023-07-15 22:34:31.075577
"""
from alembic import op
import sqlalchemy as sa
import sqlalchemy_utils
# revision identifiers, used by Alembic.
revision = 'e8d2a7570f70'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('blacklist_tokens',
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
sa.Column('token', sa.String(length=500), nullable=False),
sa.Column('expires', sa.DateTime(), nullable=False),
sa.PrimaryKeyConstraint('id', name=op.f('pk_blacklist_tokens')),
sa.UniqueConstraint('token', name=op.f('uq_blacklist_tokens_token'))
)
op.create_table('server_settings',
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
sa.Column('default_permissions_number', sa.BigInteger(), nullable=False),
sa.PrimaryKeyConstraint('id', name=op.f('pk_server_settings'))
)
op.create_table('users',
sa.Column('username', sa.String(length=255), nullable=False),
sa.Column('password_hash', sa.String(length=255), nullable=False),
sa.Column('register_date', sa.DateTime(), nullable=False),
sa.Column('permissions_number', sa.BigInteger(), nullable=False),
sa.PrimaryKeyConstraint('username', name=op.f('pk_users')),
sa.UniqueConstraint('username', name=op.f('uq_users_username'))
)
op.create_table('shares',
sa.Column('share_id', sqlalchemy_utils.types.uuid.UUIDType(), nullable=False),
sa.Column('owner_name', sa.String(), nullable=True),
sa.Column('initialized', sa.Boolean(), nullable=False),
sa.Column('locked', sa.Boolean(), nullable=False),
sa.Column('create_date', sa.DateTime(), nullable=False),
sa.Column('file_name', sa.String(), nullable=False),
sa.ForeignKeyConstraint(['owner_name'], ['users.username'], name=op.f('fk_shares_owner_name_users')),
sa.PrimaryKeyConstraint('share_id', name=op.f('pk_shares'))
)
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'], name=op.f('fk_uploads_share_id_shares')),
sa.PrimaryKeyConstraint('upload_id', name=op.f('pk_uploads'))
)
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'], name=op.f('fk_chunks_upload_id_uploads'), ondelete='CASCADE'),
sa.PrimaryKeyConstraint('chunk_id', name=op.f('pk_chunks'))
)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table('chunks')
op.drop_table('uploads')
op.drop_table('shares')
op.drop_table('users')
op.drop_table('server_settings')
op.drop_table('blacklist_tokens')
# ### end Alembic commands ###