36 lines
1.2 KiB
Python
36 lines
1.2 KiB
Python
import oracledb
|
|
|
|
conn = oracledb.connect(user="sisvietnam", password="sisvietnam", dsn="localhost:1521/sisvietnam")
|
|
cursor = conn.cursor()
|
|
|
|
# === STEP 1: Clean up duplicates ===
|
|
duplicates_to_delete = [
|
|
"tim-mach-2",
|
|
"phau-thuat-gay-me-hoi-suc-2",
|
|
"khoa-dinh-dung-tiet-che",
|
|
"khoa-than-kinh-dot-quy-2",
|
|
]
|
|
|
|
# Also delete from menu items first
|
|
for slug in duplicates_to_delete:
|
|
cursor.execute("DELETE FROM sis_menu_item WHERE url = :1", [f"/chuyen-khoa/{slug}"])
|
|
cursor.execute("DELETE FROM sis_page WHERE slug = :1", [slug])
|
|
print(f"Deleted duplicate: {slug}")
|
|
|
|
# Fix title for khoa-than-kinh-dot-quy (was "Khoa Thần kinh - Đột quỵ 2")
|
|
cursor.execute("UPDATE sis_page SET title = N'Khoa Thần kinh - Đột quỵ' WHERE slug = 'khoa-than-kinh-dot-quy'")
|
|
|
|
# Fix title for tim-mach
|
|
cursor.execute("UPDATE sis_page SET title = N'Khoa Nội Tổng Hợp' WHERE slug = 'tim-mach'")
|
|
|
|
conn.commit()
|
|
|
|
# === STEP 2: Verify remaining specialties ===
|
|
cursor.execute("SELECT slug, title FROM sis_page WHERE layout='SPECIALTY_DETAIL' ORDER BY title")
|
|
rows = cursor.fetchall()
|
|
print(f"\n=== Remaining specialties: {len(rows)} ===")
|
|
for row in rows:
|
|
print(f" {row[0]} | {row[1]}")
|
|
|
|
conn.close()
|