# Copyright (C) 2024 Bloomberg LP
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#  <http://www.apache.org/licenses/LICENSE-2.0>
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""Add blobs table for SQLStorage

Revision ID: 316ad77858af
Revises: d4efbcc698ca
Create Date: 2024-02-20 12:39:33.255751

"""
import sqlalchemy as sa
from alembic import op

# revision identifiers, used by Alembic.
revision = "316ad77858af"
down_revision = "d4efbcc698ca"
branch_labels = None
depends_on = None


def upgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        "blobs",
        sa.Column("digest_hash", sa.String(), nullable=False),
        sa.Column("digest_size_bytes", sa.BigInteger(), nullable=False),
        sa.Column("data", sa.LargeBinary(), nullable=False),
        sa.PrimaryKeyConstraint("digest_hash"),
    )
    # ### end Alembic commands ###


def downgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table("blobs")
    # ### end Alembic commands ###
