ac6c97b6ce
SSHKey model was missing created_at/updated_at columns which the API response model expected. Add TimestampMixin and Alembic migration.
45 lines
1.0 KiB
Python
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")
|