Fix: Migration 0097 — api_tokens.updated_at Spalte hinzufuegen
ApiToken Modell erbt von TenantMixin (TimestampMixin) das updated_at erwartet. Migration 0001 hat api_tokens ohne updated_at erstellt. Migration 0083 hat deleted_at hinzugefuegt aber updated_at verpasst.
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
"""Fix api_tokens table: add updated_at column.
|
||||
|
||||
The ApiToken model inherits from TenantMixin which includes TimestampMixin
|
||||
(created_at, updated_at). Migration 0001 created api_tokens without updated_at.
|
||||
Migration 0083 added deleted_at but missed updated_at.
|
||||
|
||||
Revision ID: 0097
|
||||
Revises: 0096
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from alembic import op
|
||||
|
||||
revision = "0097"
|
||||
down_revision = "0096"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
op.execute(
|
||||
"ALTER TABLE IF EXISTS api_tokens "
|
||||
"ADD COLUMN IF NOT EXISTS updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()"
|
||||
)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
op.execute("ALTER TABLE IF EXISTS api_tokens DROP COLUMN IF EXISTS updated_at")
|
||||
Reference in New Issue
Block a user