52 lines
1.8 KiB
Python
52 lines
1.8 KiB
Python
"""add_service_detail_fields
|
|
|
|
Revision ID: service_detail_001
|
|
Revises: staff_shifts_001
|
|
Create Date: 2024-12-04 22:00:00.000000
|
|
|
|
"""
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
from sqlalchemy.dialects import mysql
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision = 'service_detail_001'
|
|
down_revision = 'staff_shifts_001'
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
# Add slug column with unique index
|
|
op.add_column('services', sa.Column('slug', sa.String(200), nullable=True))
|
|
op.create_index(op.f('ix_services_slug'), 'services', ['slug'], unique=True)
|
|
|
|
# Add image column
|
|
op.add_column('services', sa.Column('image', sa.String(1000), nullable=True))
|
|
|
|
# Add content column for full HTML content
|
|
op.add_column('services', sa.Column('content', sa.Text(), nullable=True))
|
|
|
|
# Add sections column for advanced content blocks (stored as JSON)
|
|
op.add_column('services', sa.Column('sections', sa.Text(), nullable=True))
|
|
|
|
# Add SEO meta fields
|
|
op.add_column('services', sa.Column('meta_title', sa.String(500), nullable=True))
|
|
op.add_column('services', sa.Column('meta_description', sa.Text(), nullable=True))
|
|
op.add_column('services', sa.Column('meta_keywords', sa.String(1000), nullable=True))
|
|
|
|
# Rename is_active to status for consistency (optional, but let's keep is_active and add status)
|
|
# Actually, let's keep is_active as is for backward compatibility
|
|
|
|
|
|
def downgrade() -> None:
|
|
op.drop_index(op.f('ix_services_slug'), table_name='services')
|
|
op.drop_column('services', 'meta_keywords')
|
|
op.drop_column('services', 'meta_description')
|
|
op.drop_column('services', 'meta_title')
|
|
op.drop_column('services', 'sections')
|
|
op.drop_column('services', 'content')
|
|
op.drop_column('services', 'image')
|
|
op.drop_column('services', 'slug')
|
|
|