Files
giglez/scripts/migrate_add_flipper_columns.py
T
leetcrypt 9f73595b20 feat: RTL_433 protocol database import - iteration 1/5
- Expanded protocol database from 18 → 299 signatures (16.6x increase)
- Imported 281 protocols from RTL_433 open-source database (286 total devices)
- Created automated import script: scripts/import_rtl433_protocols.py
- Generated rtl433_protocols_imported.py with timing/frequency/modulation data
- Updated protocol_database.py to include RTL433_PROTOCOLS
- All 26 tests passing

Breakdown by category:
  - Weather: 116 protocols
  - Sensors: 36 protocols
  - TPMS: 25 protocols
  - Security: 23 protocols
  - Home Automation: 18 protocols
  - Other: 50+ protocols

Frequency coverage:
  - 433.92 MHz: 248 protocols
  - 315.00 MHz: 32 protocols
  - 915.00 MHz: 1 protocol

This provides comprehensive coverage of Sub-GHz IoT devices for accurate
identification from raw RF captures.
2026-02-14 18:55:55 -08:00

60 lines
1.7 KiB
Python

#!/usr/bin/env python3
"""
Add missing columns to flipper_signatures table
"""
import sys
from pathlib import Path
# Add project root to path
sys.path.insert(0, str(Path(__file__).parent.parent))
from src.database.connection import get_engine
from sqlalchemy import text
def main():
engine = get_engine()
with engine.connect() as conn:
print("Adding missing columns to flipper_signatures table...")
try:
# Add file_hash column
conn.execute(text("""
ALTER TABLE flipper_signatures
ADD COLUMN IF NOT EXISTS file_hash VARCHAR(64) UNIQUE
"""))
conn.execute(text("""
CREATE INDEX IF NOT EXISTS ix_flipper_signatures_file_hash
ON flipper_signatures(file_hash)
"""))
print("✓ Added file_hash column")
except Exception as e:
print(f"file_hash: {e}")
try:
# Add file_path column
conn.execute(text("""
ALTER TABLE flipper_signatures
ADD COLUMN IF NOT EXISTS file_path VARCHAR(500)
"""))
print("✓ Added file_path column")
except Exception as e:
print(f"file_path: {e}")
try:
# Add raw_format column
conn.execute(text("""
ALTER TABLE flipper_signatures
ADD COLUMN IF NOT EXISTS raw_format VARCHAR(20)
"""))
print("✓ Added raw_format column")
except Exception as e:
print(f"raw_format: {e}")
conn.commit()
print("\n✓ Migration complete!")
if __name__ == "__main__":
main()