diff --git a/migrations/versions/e8d2a7570f70_.py b/migrations/versions/e8d2a7570f70_.py index 938bc21..1bb13b7 100644 --- a/migrations/versions/e8d2a7570f70_.py +++ b/migrations/versions/e8d2a7570f70_.py @@ -11,7 +11,7 @@ import sqlalchemy_utils # revision identifiers, used by Alembic. -revision = 'e8d2a7570f70' +revision = "e8d2a7570f70" down_revision = None branch_labels = None depends_on = None @@ -19,64 +19,79 @@ 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( + "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( + "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( + "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( + "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( + "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')) + 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') + 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 ###