Improve the frontend 5
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
"""add_school_calendars_and_location_context
|
||||
|
||||
Revision ID: 693e0d98eaf9
|
||||
Revises: b97bab14ac47
|
||||
Create Date: 2025-11-02 08:56:45.463138+01:00
|
||||
|
||||
"""
|
||||
from typing import Sequence, Union
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision: str = '693e0d98eaf9'
|
||||
down_revision: Union[str, None] = 'b97bab14ac47'
|
||||
branch_labels: Union[str, Sequence[str], None] = None
|
||||
depends_on: Union[str, Sequence[str], None] = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
# Create school_calendars table
|
||||
op.create_table(
|
||||
'school_calendars',
|
||||
sa.Column('id', postgresql.UUID(as_uuid=True), nullable=False),
|
||||
sa.Column('city_id', sa.String(length=50), nullable=False),
|
||||
sa.Column('calendar_name', sa.String(length=100), nullable=False),
|
||||
sa.Column('school_type', sa.String(length=20), nullable=False),
|
||||
sa.Column('academic_year', sa.String(length=10), nullable=False),
|
||||
sa.Column('holiday_periods', postgresql.JSONB(astext_type=sa.Text()), nullable=False),
|
||||
sa.Column('school_hours', postgresql.JSONB(astext_type=sa.Text()), nullable=False),
|
||||
sa.Column('source', sa.String(length=100), nullable=True),
|
||||
sa.Column('enabled', sa.Boolean(), nullable=False),
|
||||
sa.Column('created_at', sa.DateTime(timezone=True), nullable=True),
|
||||
sa.Column('updated_at', sa.DateTime(timezone=True), nullable=True),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_index('idx_school_calendar_city_year', 'school_calendars', ['city_id', 'academic_year'], unique=False)
|
||||
op.create_index('idx_school_calendar_city_type', 'school_calendars', ['city_id', 'school_type'], unique=False)
|
||||
op.create_index(op.f('ix_school_calendars_city_id'), 'school_calendars', ['city_id'], unique=False)
|
||||
|
||||
# Create tenant_location_contexts table
|
||||
op.create_table(
|
||||
'tenant_location_contexts',
|
||||
sa.Column('tenant_id', postgresql.UUID(as_uuid=True), nullable=False),
|
||||
sa.Column('city_id', sa.String(length=50), nullable=False),
|
||||
sa.Column('school_calendar_id', postgresql.UUID(as_uuid=True), nullable=True),
|
||||
sa.Column('neighborhood', sa.String(length=100), nullable=True),
|
||||
sa.Column('local_events', postgresql.JSONB(astext_type=sa.Text()), nullable=True),
|
||||
sa.Column('notes', sa.String(length=500), nullable=True),
|
||||
sa.Column('created_at', sa.DateTime(timezone=True), nullable=True),
|
||||
sa.Column('updated_at', sa.DateTime(timezone=True), nullable=True),
|
||||
sa.PrimaryKeyConstraint('tenant_id')
|
||||
)
|
||||
op.create_index('idx_tenant_location_calendar', 'tenant_location_contexts', ['school_calendar_id'], unique=False)
|
||||
op.create_index(op.f('ix_tenant_location_contexts_city_id'), 'tenant_location_contexts', ['city_id'], unique=False)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
# Drop tenant_location_contexts table
|
||||
op.drop_index(op.f('ix_tenant_location_contexts_city_id'), table_name='tenant_location_contexts')
|
||||
op.drop_index('idx_tenant_location_calendar', table_name='tenant_location_contexts')
|
||||
op.drop_table('tenant_location_contexts')
|
||||
|
||||
# Drop school_calendars table
|
||||
op.drop_index(op.f('ix_school_calendars_city_id'), table_name='school_calendars')
|
||||
op.drop_index('idx_school_calendar_city_type', table_name='school_calendars')
|
||||
op.drop_index('idx_school_calendar_city_year', table_name='school_calendars')
|
||||
op.drop_table('school_calendars')
|
||||
Reference in New Issue
Block a user