Spaces:
Paused
Paused
Download migrate_mfa.py from YOSOYYONOSOYOTRO/crowdata: direct link, hf CLI and curl.
- Browser
- Download file 670 Bytes
-
https://huggingface.co/spaces/YOSOYYONOSOYOTRO/crowdata/resolve/main/migrate_mfa.py
- Command line
-
hf download hf://spaces/YOSOYYONOSOYOTRO/crowdata/migrate_mfa.py
-
curl -L -o migrate_mfa.py https://huggingface.co/spaces/YOSOYYONOSOYOTRO/crowdata/resolve/main/migrate_mfa.py
670 Bytes
| import sqlite3 | |
| conn = sqlite3.connect('crowdata.db') | |
| cursor = conn.cursor() | |
| # Add MFA columns | |
| for col, col_type in [ | |
| ('mfa_enabled', 'BOOLEAN DEFAULT FALSE'), | |
| ('mfa_secret', 'VARCHAR(255)'), | |
| ('mfa_backup_codes', 'VARCHAR(500)'), | |
| ('mfa_verified_at', 'DATETIME') | |
| ]: | |
| try: | |
| cursor.execute(f'ALTER TABLE users ADD COLUMN {col} {col_type}') | |
| print(f'Added column: {col}') | |
| except Exception as e: | |
| if 'duplicate' in str(e).lower() or 'already exists' in str(e).lower(): | |
| print(f'Column already exists: {col}') | |
| else: | |
| print(f'Error adding {col}: {e}') | |
| conn.commit() | |
| conn.close() | |
| print('Migration done') |