from sqlmodel import Session, create_engine, text from database import DATABASE_URL def add_column(): engine = create_engine(DATABASE_URL) with Session(engine) as session: try: session.exec(text("ALTER TABLE comment ADD COLUMN parent_id INTEGER REFERENCES comment(id)")) session.commit() print("Successfully added parent_id column to comment table") except Exception as e: print(f"Error adding column (might already exist): {e}") if __name__ == "__main__": add_column()