"""secrets plural + type

Revision ID: ee4924ac4f60
Revises: 9de11ef8ba39
Create Date: 2026-01-21 15:02:43.409666

"""
from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql

# revision identifiers, used by Alembic.
revision: str = 'ee4924ac4f60'
down_revision: Union[str, Sequence[str], None] = '9de11ef8ba39'
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
    """Upgrade schema."""
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('px_cloud_secrets',
    sa.Column('target_pve', sa.String(length=253), nullable=False),
    sa.Column('secret_name', sa.String(length=253), nullable=False),
    sa.Column('secret_data', postgresql.JSONB(astext_type=sa.Text()), nullable=False),
    sa.Column('secret_type', sa.String(length=50), nullable=True),
    sa.PrimaryKeyConstraint('target_pve', 'secret_name')
    )
    op.drop_table('px_cloud_secret')
    # ### end Alembic commands ###


def downgrade() -> None:
    """Downgrade schema."""
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('px_cloud_secret',
    sa.Column('target_pve', sa.VARCHAR(length=253), autoincrement=False, nullable=False),
    sa.Column('secret_name', sa.VARCHAR(length=253), autoincrement=False, nullable=False),
    sa.Column('secret_data', postgresql.JSONB(astext_type=sa.Text()), autoincrement=False, nullable=False),
    sa.PrimaryKeyConstraint('target_pve', 'secret_name', name=op.f('px_cloud_secret_pkey'))
    )
    op.drop_table('px_cloud_secrets')
    # ### end Alembic commands ###
