Files
tianxuan/analysis/migrations/0004_tls_ref_data.py
T
PM-pinou 8fa36b774e v7: 19 issues fixed — SQLite storage, new clustering pipeline, display_id, globe rewrite, Chinese tools
Key changes:
- New: data_loader.py SQLite persistence with drop_sqlite_table
- New: db_utils.py retry_on_lock decorator (3 retries, exponential backoff)
- New: tool_registry.py with 27 MCP tools (filter_and_cluster, compute_scores, etc.)
- New: tls_ref.py for TLS cipher/reference data
- New: import_tlsdb.py management command
- New: scripts/start_server.py for portable runtime
- New: migrations 0003-0007 for SQLite table, display_id, llm fields
- Changed: views.py unified pipeline worker, retry_run, display_id everywhere
- Changed: models.py with display_id auto-assignment, run_type, sqlite_table, llm_thinking, tool_calls_json
- Changed: urls.py added retry_run route
- Changed: session_store.py robust JSON persistence
- Changed: AGENTS.md v7 fix summary added
- Changed: templates — globe rewrite (inertia/polar flip), auto.html (thinking/tool accordions), base.html (toast/config), all pages use display_id
- Changed: run.bat PYTHONUTF8=1
- Deleted: entity_detector.py, entity_aggregator.py (replaced by filter_and_cluster clustering pipeline)
- Test: 92/92 unit tests passing
2026-07-20 13:33:13 +08:00

39 lines
1.0 KiB
Python

"""Migration 0004 — create raw SQLite table ``tls_ref_data``.
Replaces the ``TlsDB.csv`` reference file with a proper SQLite table.
The table stores TLS field-code metadata: human-readable meaning and
data type for each field code used in TLS flow data.
"""
from django.db import migrations
# Raw SQL for creating the tls_ref_data table
CREATE_TLS_REF_DATA = """
CREATE TABLE IF NOT EXISTS tls_ref_data (
id INTEGER PRIMARY KEY AUTOINCREMENT,
field_code TEXT NOT NULL UNIQUE,
meaning TEXT NOT NULL DEFAULT '',
data_type TEXT NOT NULL DEFAULT ''
);
"""
DROP_TLS_REF_DATA = """
DROP TABLE IF EXISTS tls_ref_data;
"""
class Migration(migrations.Migration):
"""Create ``tls_ref_data`` table via raw SQL — no Django model needed."""
dependencies = [
('tianxuan_analysis', '0003_analysisrun_sqlite_table'),
]
operations = [
migrations.RunSQL(
sql=CREATE_TLS_REF_DATA,
reverse_sql=DROP_TLS_REF_DATA,
state_operations=None,
),
]