"""add timestamps to ssh_keys table

Revision ID: 0005_ssh_keys_timestamps
Revises: 0004_tool_types
Create Date: 2026-05-19 09:00:00.000000

"""
from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision: str = "0005_ssh_keys_timestamps"
down_revision: Union[str, None] = "0004_tool_types"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
    op.add_column(
        "ssh_keys",
        sa.Column(
            "created_at",
            sa.DateTime(timezone=True),
            server_default=sa.text("now()"),
            nullable=True,
        ),
    )
    op.add_column(
        "ssh_keys",
        sa.Column(
            "updated_at",
            sa.DateTime(timezone=True),
            server_default=sa.text("now()"),
            nullable=True,
        ),
    )


def downgrade() -> None:
    op.drop_column("ssh_keys", "updated_at")
    op.drop_column("ssh_keys", "created_at")
