# app/models.py from sqlalchemy import Column, Integer, String, DateTime, Boolean, Text from sqlalchemy.orm import declarative_base from sqlalchemy.sql import func # In newer versions of SQLAlchemy, declarative_base is imported from sqlalchemy.orm Base = declarative_base() class Professional(Base): __tablename__ = 'professionals_denormalized' id = Column(Integer, primary_key=True) # SERIAL PRIMARY KEY is handled name = Column(String(255), nullable=False) professional_role = Column(String(255)) email = Column(String(255), unique=True, index=True, nullable=False) phone = Column(String(20), unique=True) # Added unique constraint based on common usage password_hash = Column(String(255), nullable=False) # New and updated text/varchar fields profile_photo_url = Column(Text) profile_photo_id = Column(String(255)) banner_url = Column(Text) banner_id = Column(String(255)) skills = Column(Text) # Changed from JSON to Text to match your SQL description = Column(Text) google_id = Column(String(255)) linkedin_id = Column(String(255)) role = Column(String(50)) avatar = Column(String(5)) # Added length limit # Boolean and Integer fields is_admin = Column(Boolean, default=False) rewardScore = Column("rewardScore", Integer, default=0) # Explicitly name to handle case-sensitivity matchScore = Column("matchScore", Integer, default=0) # New location fields location1 = Column(String(255)) location2 = Column(String(255)) location3 = Column(String(255)) location4 = Column(String(255)) location5 = Column(String(255)) # Kept the automatic timestamping from your original model as it's a best practice created_at = Column(DateTime(timezone=True), server_default=func.now()) updated_at = Column(DateTime(timezone=True), onupdate=func.now())