feat(gallery): add is_gallery_featured and gallery_sort_order columns to trees and script_templates
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,40 @@
|
|||||||
|
"""add gallery featuring columns to trees and script_templates
|
||||||
|
|
||||||
|
Revision ID: 9094262a4be3
|
||||||
|
Revises: b09c3789b7e6
|
||||||
|
Create Date: 2026-03-19 19:07:25.964399
|
||||||
|
|
||||||
|
"""
|
||||||
|
from typing import Sequence, Union
|
||||||
|
|
||||||
|
from alembic import op
|
||||||
|
import sqlalchemy as sa
|
||||||
|
|
||||||
|
|
||||||
|
# revision identifiers, used by Alembic.
|
||||||
|
revision: str = '9094262a4be3'
|
||||||
|
down_revision: Union[str, None] = 'b09c3789b7e6'
|
||||||
|
branch_labels: Union[str, Sequence[str], None] = None
|
||||||
|
depends_on: Union[str, Sequence[str], None] = None
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade() -> None:
|
||||||
|
# Add gallery featuring columns to trees
|
||||||
|
op.add_column('trees', sa.Column('is_gallery_featured', sa.Boolean(), nullable=False, server_default=sa.text('false')))
|
||||||
|
op.add_column('trees', sa.Column('gallery_sort_order', sa.Integer(), nullable=False, server_default=sa.text('0')))
|
||||||
|
op.create_index(op.f('ix_trees_is_gallery_featured'), 'trees', ['is_gallery_featured'], unique=False)
|
||||||
|
|
||||||
|
# Add gallery featuring columns to script_templates
|
||||||
|
op.add_column('script_templates', sa.Column('is_gallery_featured', sa.Boolean(), nullable=False, server_default=sa.text('false')))
|
||||||
|
op.add_column('script_templates', sa.Column('gallery_sort_order', sa.Integer(), nullable=False, server_default=sa.text('0')))
|
||||||
|
op.create_index(op.f('ix_script_templates_is_gallery_featured'), 'script_templates', ['is_gallery_featured'], unique=False)
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade() -> None:
|
||||||
|
op.drop_index(op.f('ix_script_templates_is_gallery_featured'), table_name='script_templates')
|
||||||
|
op.drop_column('script_templates', 'gallery_sort_order')
|
||||||
|
op.drop_column('script_templates', 'is_gallery_featured')
|
||||||
|
|
||||||
|
op.drop_index(op.f('ix_trees_is_gallery_featured'), table_name='trees')
|
||||||
|
op.drop_column('trees', 'gallery_sort_order')
|
||||||
|
op.drop_column('trees', 'is_gallery_featured')
|
||||||
@@ -65,6 +65,8 @@ class ScriptTemplate(Base):
|
|||||||
version: Mapped[int] = mapped_column(Integer, nullable=False, default=1)
|
version: Mapped[int] = mapped_column(Integer, nullable=False, default=1)
|
||||||
is_verified: Mapped[bool] = mapped_column(Boolean, nullable=False, default=False)
|
is_verified: Mapped[bool] = mapped_column(Boolean, nullable=False, default=False)
|
||||||
is_active: Mapped[bool] = mapped_column(Boolean, nullable=False, default=True)
|
is_active: Mapped[bool] = mapped_column(Boolean, nullable=False, default=True)
|
||||||
|
is_gallery_featured: Mapped[bool] = mapped_column(Boolean, nullable=False, default=False, index=True)
|
||||||
|
gallery_sort_order: Mapped[int] = mapped_column(Integer, nullable=False, default=0)
|
||||||
usage_count: Mapped[int] = mapped_column(Integer, nullable=False, default=0)
|
usage_count: Mapped[int] = mapped_column(Integer, nullable=False, default=0)
|
||||||
created_at: Mapped[datetime] = mapped_column(
|
created_at: Mapped[datetime] = mapped_column(
|
||||||
DateTime(timezone=True), default=lambda: datetime.now(timezone.utc)
|
DateTime(timezone=True), default=lambda: datetime.now(timezone.utc)
|
||||||
|
|||||||
@@ -85,6 +85,8 @@ class Tree(Base):
|
|||||||
is_active: Mapped[bool] = mapped_column(Boolean, default=True)
|
is_active: Mapped[bool] = mapped_column(Boolean, default=True)
|
||||||
is_public: Mapped[bool] = mapped_column(Boolean, default=False, index=True)
|
is_public: Mapped[bool] = mapped_column(Boolean, default=False, index=True)
|
||||||
is_default: Mapped[bool] = mapped_column(Boolean, default=False, index=True)
|
is_default: Mapped[bool] = mapped_column(Boolean, default=False, index=True)
|
||||||
|
is_gallery_featured: Mapped[bool] = mapped_column(Boolean, default=False, index=True)
|
||||||
|
gallery_sort_order: Mapped[int] = mapped_column(Integer, default=0)
|
||||||
visibility: Mapped[str] = mapped_column(
|
visibility: Mapped[str] = mapped_column(
|
||||||
String(20),
|
String(20),
|
||||||
nullable=False,
|
nullable=False,
|
||||||
|
|||||||
Reference in New Issue
Block a user