Agent-Logs-Url: https://github.com/genichin/portfolio-hub/sessions/64fc2cec-78f5-41d1-99a4-45f868781edd Co-authored-by: genichin <4282227+genichin@users.noreply.github.com>
40 lines
1.1 KiB
Python
40 lines
1.1 KiB
Python
"""portfolio_comments table
|
|
|
|
Revision ID: 20260410_0009
|
|
Revises: 20260403_0008
|
|
Create Date: 2026-04-10 00:00:00
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import sqlalchemy as sa
|
|
from alembic import op
|
|
|
|
|
|
revision = "20260410_0009"
|
|
down_revision = "20260403_0008"
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
op.create_table(
|
|
"portfolio_comments",
|
|
sa.Column("id", sa.Text(), primary_key=True),
|
|
sa.Column("portfolio_id", sa.Text(), nullable=False),
|
|
sa.Column("content", sa.Text(), nullable=False),
|
|
sa.Column("created_at", sa.DateTime(timezone=True), nullable=False, server_default=sa.text("NOW()")),
|
|
sa.Column("updated_at", sa.DateTime(timezone=True), nullable=False, server_default=sa.text("NOW()")),
|
|
)
|
|
op.create_index(
|
|
"idx_portfolio_comments_portfolio_created",
|
|
"portfolio_comments",
|
|
["portfolio_id", sa.text("created_at DESC")],
|
|
unique=False,
|
|
)
|
|
|
|
|
|
def downgrade() -> None:
|
|
op.drop_index("idx_portfolio_comments_portfolio_created", table_name="portfolio_comments")
|
|
op.drop_table("portfolio_comments")
|