Automated Action b852025088 Create Website Update Alert Service
- FastAPI application that monitors websites for updates
- SQLite database with Website and WebsiteAlert models
- REST API endpoints for website management and alerts
- Background scheduler for automatic periodic checks
- Content hashing to detect website changes
- Health check endpoint and comprehensive documentation
- Alembic migrations for database schema management
- CORS middleware for cross-origin requests
- Environment variable configuration support

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-27 10:57:32 +00:00

50 lines
1.8 KiB
Python

"""Initial migration - create websites and website_alerts tables
Revision ID: 001
Revises:
Create Date: 2024-01-01 12:00:00.000000
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '001'
down_revision = None
branch_labels = None
depends_on = None
def upgrade() -> None:
# Create websites table
op.create_table('websites',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('url', sa.String(), nullable=False),
sa.Column('name', sa.String(), nullable=False),
sa.Column('last_checked', sa.DateTime(), nullable=True),
sa.Column('last_content_hash', sa.String(), nullable=True),
sa.Column('is_active', sa.Boolean(), nullable=True),
sa.Column('check_interval_minutes', sa.Integer(), nullable=True),
sa.Column('created_at', sa.DateTime(), nullable=True),
sa.Column('updated_at', sa.DateTime(), nullable=True),
sa.PrimaryKeyConstraint('id')
)
op.create_index(op.f('ix_websites_id'), 'websites', ['id'], unique=False)
op.create_index(op.f('ix_websites_url'), 'websites', ['url'], unique=True)
# Create website_alerts table
op.create_table('website_alerts',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('website_id', sa.Integer(), nullable=False),
sa.Column('alert_message', sa.Text(), nullable=False),
sa.Column('detected_at', sa.DateTime(), nullable=True),
sa.Column('is_read', sa.Boolean(), nullable=True),
sa.PrimaryKeyConstraint('id')
)
def downgrade() -> None:
op.drop_table('website_alerts')
op.drop_index(op.f('ix_websites_url'), table_name='websites')
op.drop_index(op.f('ix_websites_id'), table_name='websites')
op.drop_table('websites')