Spaces:
Sleeping
Sleeping
Download migrations/migrate_fasting_time.py from alisaleem97/NexLab_System: direct link, hf CLI and curl.
- Browser
- Download file 668 Bytes
-
https://huggingface.co/spaces/alisaleem97/NexLab_System/resolve/main/migrations/migrate_fasting_time.py
- Command line
-
hf download hf://spaces/alisaleem97/NexLab_System/migrations/migrate_fasting_time.py
-
curl -L -o migrate_fasting_time.py https://huggingface.co/spaces/alisaleem97/NexLab_System/resolve/main/migrations/migrate_fasting_time.py
668 Bytes
| """Migration script to add fasting_time column to patient table.""" | |
| import sqlite3 | |
| def migrate(): | |
| conn = sqlite3.connect("lab_database.db") | |
| cursor = conn.cursor() | |
| # Check if column already exists | |
| cursor.execute("PRAGMA table_info(patient)") | |
| columns = [col[1] for col in cursor.fetchall()] | |
| if "fasting_time" not in columns: | |
| cursor.execute("ALTER TABLE patient ADD COLUMN fasting_time INTEGER DEFAULT NULL") | |
| conn.commit() | |
| print("✅ Added fasting_time column to patient table") | |
| else: | |
| print("ℹ️ fasting_time column already exists") | |
| conn.close() | |
| if __name__ == "__main__": | |
| migrate() | |