#!/usr/bin/env python3
"""Migration script to add research ratings table."""

import sys
from pathlib import Path

# Add the project root to Python path
project_root = Path(__file__).parent.parent.parent.parent
sys.path.insert(0, str(project_root))

# Import after path modification
from local_deep_research.metrics.database import MetricsDatabase  # noqa: E402
from local_deep_research.metrics.db_models import ResearchRating  # noqa: E402


def main():
    """Run the migration to add research ratings table."""
    print("Creating research ratings table...")

    # Initialize database
    db = MetricsDatabase()

    # Create the research_ratings table
    ResearchRating.__table__.create(db.engine, checkfirst=True)

    print("✅ Research ratings table created successfully!")
    print("Users can now rate their research sessions on a 1-5 star scale.")


if __name__ == "__main__":
    main()
