feat(blog): جداسازی دوزبانهٔ اسلاگ/کلیدواژه/نویسنده/تگها/متا + میگریشن ۰۰۰۲، رفع «دقیقه مطالعه دقیقه»، فونت مقاله ۱۵/۱۷px، جدول تیپتپ در ادیتور، مسیر /en/blog با slug_en
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
"""ستونهای چندزبانه مقاله — اسلاگ/کلیدواژه/نویسنده انگلیسی و تگهای دو زبانه.
|
||||
|
||||
فیلدهای «نویسنده» و «متا دیسکریپشن» در ادیتور تا پیش از این نسخه یا مشترک
|
||||
بودند یا بیاثر؛ از این نسخه هر زبان ستون خودش را دارد.
|
||||
|
||||
Revision ID: 0002
|
||||
Revises: 0001
|
||||
Create Date: 2026-10-01
|
||||
"""
|
||||
from typing import Sequence, Union
|
||||
|
||||
import sqlalchemy as sa
|
||||
from alembic import op
|
||||
|
||||
revision: str = "0002"
|
||||
down_revision: Union[str, None] = "0001"
|
||||
branch_labels: Union[str, Sequence[str], None] = None
|
||||
depends_on: Union[str, Sequence[str], None] = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
articles = sa.table("articles")
|
||||
columns = sa.inspect(op.get_bind()).get_columns("articles")
|
||||
existing = {c["name"] for c in columns}
|
||||
if "slug_en" not in existing:
|
||||
op.add_column("articles", sa.Column("slug_en", sa.String(128), nullable=False, server_default=""))
|
||||
if "seo_keyphrase_en" not in existing:
|
||||
op.add_column("articles", sa.Column("seo_keyphrase_en", sa.String(128), nullable=False, server_default=""))
|
||||
if "author_en" not in existing:
|
||||
op.add_column("articles", sa.Column("author_en", sa.String(128), nullable=False, server_default=""))
|
||||
if "tags" not in existing:
|
||||
op.add_column("articles", sa.Column("tags", sa.JSON(), nullable=False, server_default="[]"))
|
||||
if "tags_en" not in existing:
|
||||
op.add_column("articles", sa.Column("tags_en", sa.JSON(), nullable=False, server_default="[]"))
|
||||
_ = articles
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
op.drop_column("articles", "tags_en")
|
||||
op.drop_column("articles", "tags")
|
||||
op.drop_column("articles", "author_en")
|
||||
op.drop_column("articles", "seo_keyphrase_en")
|
||||
op.drop_column("articles", "slug_en")
|
||||
Reference in New Issue
Block a user