Spaces:
Sleeping
Sleeping
| import sqlite3 | |
| def migrate(): | |
| conn = sqlite3.connect("nutrition_app.db") | |
| cursor = conn.cursor() | |
| try: | |
| cursor.execute("ALTER TABLE products ADD COLUMN image_path TEXT") | |
| conn.commit() | |
| print("Successfully added image_path column to products table") | |
| except sqlite3.OperationalError as e: | |
| if "duplicate column name" in str(e): | |
| print("Column image_path already exists") | |
| else: | |
| print(f"Error: {e}") | |
| finally: | |
| conn.close() | |
| if __name__ == "__main__": | |
| migrate() | |