40 lines
1.3 KiB
Python
40 lines
1.3 KiB
Python
#!/usr/bin/env python3
|
|
"""Update the About page hero section image URL in the database."""
|
|
|
|
import asyncio
|
|
from sqlalchemy import text
|
|
from database import async_engine
|
|
|
|
async def update_hero_image():
|
|
"""Update the hero section image_url in about_content table."""
|
|
|
|
image_url = "/uploads/media/aa5bcc15-3b1e-4ed8-8708-1a3dceb9494d.jpg"
|
|
|
|
async with async_engine.begin() as conn:
|
|
# Update the hero section image_url
|
|
result = await conn.execute(
|
|
text("""
|
|
UPDATE about_content
|
|
SET image_url = :image_url,
|
|
updated_at = NOW()
|
|
WHERE section = 'hero'
|
|
"""),
|
|
{"image_url": image_url}
|
|
)
|
|
|
|
print(f"✅ Updated hero section image_url to: {image_url}")
|
|
print(f" Rows affected: {result.rowcount}")
|
|
|
|
# Verify the update
|
|
verify = await conn.execute(
|
|
text("SELECT section, image_url FROM about_content WHERE section = 'hero'")
|
|
)
|
|
row = verify.fetchone()
|
|
if row:
|
|
print(f"✅ Verified - Section: {row[0]}, Image URL: {row[1]}")
|
|
else:
|
|
print("❌ No hero section found!")
|
|
|
|
if __name__ == "__main__":
|
|
asyncio.run(update_hero_image())
|