| import sqlite3 |
| import os |
|
|
| db_path = os.path.join('data', 'literature_cache.db') |
|
|
| if not os.path.exists(db_path): |
| print("Database tidak ditemukan, mungkin Anda menggunakan path yang berbeda.") |
| else: |
| conn = sqlite3.connect(db_path) |
| cursor = conn.cursor() |
| try: |
| cursor.execute("ALTER TABLE user ADD COLUMN semantic_scholar_api_key VARCHAR(200)") |
| conn.commit() |
| print("β
Kolom semantic_scholar_api_key berhasil ditambahkan ke tabel user!") |
| except sqlite3.OperationalError as e: |
| if "duplicate column name" in str(e): |
| print("β
Kolom sudah ada, tidak perlu ditambahkan lagi.") |
| else: |
| print(f"β Error: {e}") |
| conn.close() |
|
|