"""Remove `storage_id`, and add `storage_namespace_id` in association_artifacts_storages

Revision ID: 43c7e60c56af
Revises: b6f3b3c69d16
Create Date: 2025-08-28 05:43:18.926924

"""

import sqlalchemy as sa
from alembic import op

from ai.backend.manager.models.base import GUID

# revision identifiers, used by Alembic.
revision = "43c7e60c56af"
down_revision = "b6f3b3c69d16"
branch_labels = None
depends_on = None


def upgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column(
        "association_artifacts_storages", sa.Column("storage_namespace_id", GUID(), nullable=False)
    )
    op.add_column(
        "association_artifacts_storages", sa.Column("storage_type", sa.String(), nullable=False)
    )
    op.drop_column("association_artifacts_storages", "storage_id")
    # ### end Alembic commands ###


def downgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column(
        "association_artifacts_storages",
        sa.Column("storage_id", GUID(), autoincrement=False, nullable=False),
    )
    op.drop_column("association_artifacts_storages", "storage_type")
    op.drop_column("association_artifacts_storages", "storage_namespace_id")
    # ### end Alembic commands ###
