feat: Phase 5-6 — CREATE VIEW, migrations, deadlock detection, JSON logging, admin UI

Phase 5 — ERP Features:
- CREATE VIEW name AS SELECT ... — parser + executor with view expansion
- DROP VIEW — parser + executor
- CREATE MIGRATION name AS 'sql' — parser + executor, stored in LSM-Tree
- APPLY MIGRATION name — parser + executor, replays stored migration SQL
- Views table in ExecutionContext, expanded on SELECT FROM view

Phase 6 — Production Readiness:
- Deadlock detection: timeout-based auto-abort for stale transactions (30s default)
- TxnManager.txnTimeoutMs configurable
- Structured JSON logging module (logging.nim) with levels: debug/info/warn/error
- Admin dashboard Web UI at GET /admin — SQL playground, schema browser, metrics
- Dark theme HTML/CSS with tabs

Lexer: added tkView, tkMigration, tkApply tokens
Parser: parseCreateView, parseDropView, parseCreateMigration, parseApplyMigration
AST: nkCreateView, nkDropView, nkCreateMigration, nkApplyMigration nodes

All 216 tests pass
This commit is contained in:
2026-05-06 13:54:16 +03:00
parent 633c5d127c
commit 675ab26a6e
7 changed files with 307 additions and 8 deletions
+16
View File
@@ -20,6 +20,10 @@ type
nkCommitTxn
nkRollbackTxn
nkExplainStmt
nkCreateView
nkDropView
nkCreateMigration
nkApplyMigration
# Clauses
nkFrom
@@ -200,6 +204,18 @@ type
of nkExplainStmt:
expStmt*: Node
expAnalyze*: bool
of nkCreateView:
cvName*: string
cvQuery*: Node
cvOrReplace*: bool
of nkDropView:
dvName*: string
dvIfExists*: bool
of nkCreateMigration:
cmName*: string
cmBody*: string
of nkApplyMigration:
amName*: string
of nkCreateIndex:
ciTarget*: string
ciName*: string