62 lines
2.0 KiB
Python
62 lines
2.0 KiB
Python
"""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 ###
|