Files
headquarter/apps/api/alembic/versions/0005_ssh_keys_timestamps.py
Fusion ac6c97b6ce fix: add missing timestamps to ssh_keys model
SSHKey model was missing created_at/updated_at columns which the API
response model expected. Add TimestampMixin and Alembic migration.
2026-05-19 11:51:39 +02:00

45 lines
1.0 KiB
Python

"""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")