homelab_automation/app/scripts/extract_mmd.py
Bruno Charest 984d06a223
Some checks failed
Tests / Backend Tests (Python) (3.10) (push) Has been cancelled
Tests / Backend Tests (Python) (3.11) (push) Has been cancelled
Tests / Backend Tests (Python) (3.12) (push) Has been cancelled
Tests / Frontend Tests (JS) (push) Has been cancelled
Tests / Integration Tests (push) Has been cancelled
Tests / All Tests Passed (push) Has been cancelled
feat: Implement comprehensive database schema with new models, CRUD operations, and documentation for host metrics, Docker management, and terminal sessions, while removing old test files.
2026-03-05 10:16:13 -05:00

19 lines
615 B
Python

import re
import os
docs_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', 'docs'))
schema_md_path = os.path.join(docs_dir, 'database_schema.md')
mmd_path = os.path.join(docs_dir, 'erd.mmd')
with open(schema_md_path, 'r', encoding='utf-8') as f:
content = f.read()
match = re.search(r'```mermaid\n(.*?)```', content, re.DOTALL)
if match:
mermaid_code = match.group(1).strip()
with open(mmd_path, 'w', encoding='utf-8') as f:
f.write(mermaid_code)
print(f"Mermaid code extracted to {mmd_path}")
else:
print("Could not find mermaid block in database_schema.md")